mirror of
https://github.com/openwrt/openwrt.git
synced 2025-04-07 19:34:48 +00:00
netifd: refactor packet steering init
1. Move setup code to independent script file 2. Add init.d script to allow automatic updates 3. Support platform specific /usr/libexec/platform/packet-steering.sh Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
This commit is contained in:
parent
f584fb2f7e
commit
601257e388
@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=netifd
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
|
||||
|
18
package/network/config/netifd/files/etc/init.d/packet_steering
Executable file
18
package/network/config/netifd/files/etc/init.d/packet_steering
Executable file
@ -0,0 +1,18 @@
|
||||
#!/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() {
|
||||
/usr/libexec/network/packet-steering.sh
|
||||
}
|
@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
[ "$ACTION" = add ] || exit
|
||||
|
||||
NPROCS="$(grep -c "^processor.*:" /proc/cpuinfo)"
|
||||
[ "$NPROCS" -gt 1 ] || exit
|
||||
|
||||
@ -40,6 +38,11 @@ packet_steering="$(uci get "network.@globals[0].packet_steering")"
|
||||
exec 512>/var/lock/smp_tune.lock
|
||||
flock 512 || exit 1
|
||||
|
||||
[ -e "/usr/libexec/platform/packet-steering.sh" ] && {
|
||||
/usr/libexec/platform/packet-steering.sh
|
||||
exit 0
|
||||
}
|
||||
|
||||
for dev in /sys/class/net/*; do
|
||||
[ -d "$dev" ] || continue
|
||||
|
Loading…
x
Reference in New Issue
Block a user