aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2023-02-13 09:23:39 +0100
committerRafał Miłecki <rafal@milecki.pl>2023-02-15 14:25:38 +0100
commit601257e388d7abb5ada1c1ac93e2cd2259ea3dd1 (patch)
tree4d2421408ddd940f109865e66f0556e54809d180 /package
parentf584fb2f7e6e4c2663c802d5c9367894d9d65f69 (diff)
downloadupstream-601257e388d7abb5ada1c1ac93e2cd2259ea3dd1.tar.gz
upstream-601257e388d7abb5ada1c1ac93e2cd2259ea3dd1.tar.bz2
upstream-601257e388d7abb5ada1c1ac93e2cd2259ea3dd1.zip
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>
Diffstat (limited to 'package')
-rw-r--r--package/network/config/netifd/Makefile2
-rwxr-xr-xpackage/network/config/netifd/files/etc/init.d/packet_steering18
-rwxr-xr-x[-rw-r--r--]package/network/config/netifd/files/usr/libexec/network/packet-steering.sh (renamed from package/network/config/netifd/files/etc/hotplug.d/net/20-smp-packet-steering)7
3 files changed, 24 insertions, 3 deletions
diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile
index 500daaa152..f40a990b42 100644
--- a/package/network/config/netifd/Makefile
+++ b/package/network/config/netifd/Makefile
@@ -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
diff --git a/package/network/config/netifd/files/etc/init.d/packet_steering b/package/network/config/netifd/files/etc/init.d/packet_steering
new file mode 100755
index 0000000000..9d8f791e23
--- /dev/null
+++ b/package/network/config/netifd/files/etc/init.d/packet_steering
@@ -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
+}
diff --git a/package/network/config/netifd/files/etc/hotplug.d/net/20-smp-packet-steering b/package/network/config/netifd/files/usr/libexec/network/packet-steering.sh
index 8a86bf75f6..799c080805 100644..100755
--- a/package/network/config/netifd/files/etc/hotplug.d/net/20-smp-packet-steering
+++ b/package/network/config/netifd/files/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