linux-atm: add wrapper for br2684ctl to defer nasX device bringup
authorFelix Fietkau <nbd@openwrt.org>
Mon, 14 Dec 2015 11:02:12 +0000 (11:02 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 14 Dec 2015 11:02:12 +0000 (11:02 +0000)
Fixes a race condition on netifd device bringup.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 47891

package/network/utils/linux-atm/Makefile
package/network/utils/linux-atm/files/br2684ctl
package/network/utils/linux-atm/files/br2684ctl_wrap [new file with mode: 0644]

index 51e604c0bb1e174425bc410a93d3f63a5eae2de2..9c6cfec95cf5c14d92c912a92652763ba8785f82 100644 (file)
@@ -182,7 +182,10 @@ define Package/br2684ctl/install
        $(INSTALL_BIN) ./files/br2684ctl $(1)/etc/init.d/
        $(INSTALL_DATA) ./files/atm.hotplug $(1)/etc/hotplug.d/atm/00-trigger
        $(INSTALL_DIR) $(1)/usr/sbin
-       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/br2684ctl $(1)/usr/sbin/
+       $(INSTALL_BIN) \
+               ./files/br2684ctl_wrap \
+               $(PKG_INSTALL_DIR)/usr/sbin/br2684ctl \
+               $(1)/usr/sbin/
 endef
 
 $(eval $(call BuildPackage,linux-atm))
index 3d122270e9b81e5a0950ceca3c7f72806cca806b..1cac4df04d3713665f31063740e7cf4a987dff26 100755 (executable)
@@ -58,7 +58,7 @@ start_daemon() {
 
        procd_open_instance
        procd_set_param command \
-               /usr/sbin/br2684ctl \
+               /usr/sbin/br2684ctl_wrap "nas$unit" \
                -c "$unit" -e "$encaps" -p "$payload" \
                -a "$circuit" ${qos:+-q "$qos"} ${sendsize:+-s "$sendsize"}
        procd_close_instance
diff --git a/package/network/utils/linux-atm/files/br2684ctl_wrap b/package/network/utils/linux-atm/files/br2684ctl_wrap
new file mode 100644 (file)
index 0000000..d1bc98e
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+. /lib/functions/network.sh
+device="$1"; shift
+network_defer_device "$device"
+exec /usr/sbin/br2684ctl "$@"