aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/config/netifd
diff options
context:
space:
mode:
Diffstat (limited to 'package/network/config/netifd')
-rw-r--r--package/network/config/netifd/Makefile20
-rwxr-xr-xpackage/network/config/netifd/files/etc/init.d/packet_steering18
-rwxr-xr-xpackage/network/config/netifd/files/lib/netifd/dhcp.script7
-rwxr-xr-xpackage/network/config/netifd/files/lib/netifd/proto/dhcp.sh4
-rwxr-xr-xpackage/network/config/netifd/files/sbin/ifup33
-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
6 files changed, 40 insertions, 49 deletions
diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile
index 62f3b600862..ba4516c1dc6 100644
--- a/package/network/config/netifd/Makefile
+++ b/package/network/config/netifd/Makefile
@@ -5,21 +5,23 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
-PKG_SOURCE_DATE:=2021-07-14
-PKG_SOURCE_VERSION:=7f24a063475e1e2be4e0c516a5b62c3fae5ec542
-PKG_MIRROR_HASH:=3fad25b8655e01e20f54b6c6decad6a660a34ab3ca2de97fe3c9b7db5aa485fe
+PKG_SOURCE_DATE:=2024-01-04
+PKG_SOURCE_VERSION:=f01345ec13b9b27ffd314d8689fb2d3f9c81a47d
+PKG_MIRROR_HASH:=58e92e9ce1a2c8ccb487e95dadf806f38b38abbe7cb3cde61ff880de5eb85c2f
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=
+PKG_BUILD_FLAGS:=lto
+
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/netifd
SECTION:=base
CATEGORY:=Base system
- DEPENDS:=+libuci +libnl-tiny +libubus +ubus +ubusd +jshn +libubox
+ DEPENDS:=+libuci +libnl-tiny +libubus +ubus +ubusd +jshn +libubox +libudebug
TITLE:=OpenWrt Network Interface Configuration Daemon
endef
@@ -30,10 +32,7 @@ endef
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include/libnl-tiny \
- -I$(STAGING_DIR)/usr/include \
- -flto
-
-TARGET_LDFLAGS += -flto -fuse-linker-plugin
+ -I$(STAGING_DIR)/usr/include
CMAKE_OPTIONS += \
-DLIBNL_LIBS=-lnl-tiny \
@@ -44,7 +43,10 @@ define Package/netifd/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/netifd $(1)/sbin/
$(CP) ./files/* $(1)/
$(INSTALL_DIR) $(1)/etc/udhcpc.user.d/
- $(CP) $(PKG_BUILD_DIR)/scripts/* $(1)/lib/netifd/
+ $(CP) \
+ $(PKG_BUILD_DIR)/scripts/utils.sh \
+ $(PKG_BUILD_DIR)/scripts/netifd-proto.sh \
+ $(1)/lib/netifd/
endef
$(eval $(call BuildPackage,netifd))
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 00000000000..9d8f791e23b
--- /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/lib/netifd/dhcp.script b/package/network/config/netifd/files/lib/netifd/dhcp.script
index e46005d84c6..db8deac9e67 100755
--- a/package/network/config/netifd/files/lib/netifd/dhcp.script
+++ b/package/network/config/netifd/files/lib/netifd/dhcp.script
@@ -18,13 +18,13 @@ setup_interface () {
proto_add_ipv4_address "$ip" "${subnet:-255.255.255.0}"
# TODO: apply $broadcast
- local ip_net
- eval "$(ipcalc.sh "$ip/$mask")";ip_net="$NETWORK"
+ local ip_net IP PREFIX NETWORK NETMASK BROADCAST
+ ipcalc "$ip/$mask" && ip_net="$NETWORK"
local i
for i in $router; do
local gw_net
- eval "$(ipcalc.sh "$i/$mask")";gw_net="$NETWORK"
+ ipcalc "$i/$mask" && gw_net="$NETWORK"
[ "$ip_net" != "$gw_net" ] && proto_add_ipv4_route "$i" 32 "" "$ip"
proto_add_ipv4_route 0.0.0.0 0 "$i" "$ip"
@@ -60,6 +60,7 @@ setup_interface () {
[ -n "$message" ] && json_add_string message "$message"
[ -n "$timezone" ] && json_add_int timezone "$timezone"
[ -n "$lease" ] && json_add_int leasetime "$lease"
+ [ -n "$serverid" ] && json_add_string dhcpserver "$serverid"
proto_close_data
proto_send_update "$INTERFACE"
diff --git a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
index 3034b2ba68e..636b4654ff0 100755
--- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
+++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-[ -L /sbin/udhcpc ] || exit 0
+[ -x /sbin/udhcpc ] || exit 0
. /lib/functions.sh
. ../netifd-proto.sh
@@ -67,7 +67,7 @@ proto_dhcp_setup() {
-p /var/run/udhcpc-$iface.pid \
-s /lib/netifd/dhcp.script \
-f -t 0 -i "$iface" \
- ${ipaddr:+-r $ipaddr} \
+ ${ipaddr:+-r ${ipaddr/\/*/}} \
${hostname:+-x "hostname:$hostname"} \
${vendorid:+-V "$vendorid"} \
$clientid $defaultreqopts $broadcast $norelease $dhcpopts
diff --git a/package/network/config/netifd/files/sbin/ifup b/package/network/config/netifd/files/sbin/ifup
index 15be535bbfc..fbf2fd80c7e 100755
--- a/package/network/config/netifd/files/sbin/ifup
+++ b/package/network/config/netifd/files/sbin/ifup
@@ -1,7 +1,6 @@
#!/bin/sh
ifup_all=
-setup_wifi=
if_call() {
local interface="$1"
@@ -14,7 +13,6 @@ case "$0" in
*ifdown) modes=down;;
*ifup)
modes="down up"
- setup_wifi=1
;;
*) echo "Invalid command: $0";;
esac
@@ -25,10 +23,6 @@ while :; do
ifup_all=1
shift
;;
- -w)
- setup_wifi=
- shift
- ;;
*)
break
;;
@@ -40,7 +34,6 @@ if [ -n "$ifup_all" ]; then
for interface in $(ubus -S list 'network.interface.*'); do
if_call "${interface##network.interface.}"
done
- [ -n "$setup_wifi" ] && /sbin/wifi up
exit
else
ubus -S list "network.interface.$1" > /dev/null || {
@@ -49,29 +42,3 @@ else
}
if_call "$1"
fi
-
-if [ -n "$setup_wifi" ] && grep -sq config /etc/config/wireless; then
- . /lib/functions.sh
-
- find_related_radios() {
- local wdev wnet
- config_get wdev "$1" device
- config_get wnet "$1" network
-
- if [ -n "$wdev" ]; then
- for wnet in $wnet; do
- if [ "$wnet" = "$network" ]; then
- append radio_devs "$wdev" "$N"
- fi
- done
- fi
- }
-
- network="$1"
- config_load wireless
- config_foreach find_related_radios wifi-iface
-
- for dev in $(echo "$radio_devs" | sort -u); do
- /sbin/wifi up "$dev"
- done
-fi
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 8a86bf75f60..799c0808053 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