#!/bin/sh /etc/rc.common

START=25
USE_PROCD=1

start_service() {
	reload_service
}

service_triggers() {
	procd_add_reload_trigger "network"
	procd_add_reload_trigger "firewall"
	procd_add_raw_trigger "interface.*" 1000 /etc/init.d/packet_steering reload
}

reload_service() {
	packet_steering="$(uci -q get "network.@globals[0].packet_steering")"
	steering_flows="$(uci -q get "network.@globals[0].steering_flows")"
	[ "${steering_flows:-0}" -gt 0 ] && opts="-l $steering_flows"
	if [ -e "/usr/libexec/platform/packet-steering.sh" ]; then
		/usr/libexec/platform/packet-steering.sh "$packet_steering"
	else
		/usr/libexec/network/packet-steering.uc $opts "$packet_steering"
	fi
}
