batman-adv: fix race condition between iface add and iface up
authorMarek Lindner <lindner_marek@yahoo.de>
Mon, 26 Nov 2012 10:36:23 +0000 (10:36 +0000)
committerMarek Lindner <lindner_marek@yahoo.de>
Mon, 26 Nov 2012 10:36:23 +0000 (10:36 +0000)
Signed-off-by: Gui Iribarren <gui@altermundi.net>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
SVN-Revision: 34385

net/batman-adv/Makefile
net/batman-adv/files/etc/hotplug.d/iface/99-batman-adv [new file with mode: 0644]
net/batman-adv/files/etc/hotplug.d/net/99-batman-adv
net/batman-adv/files/lib/batman-adv/config.sh

index f782ab7a51fbc26ca050d84018c1b60dc42b8dde..50f8a574efa6d04adf47ad83a296b0fcb75908d4 100644 (file)
@@ -109,10 +109,11 @@ define Build/Clean
 endef
 
 define KernelPackage/batman-adv/install
-       $(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/net $(1)/lib/batman-adv $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/net $(1)/etc/hotplug.d/iface $(1)/lib/batman-adv $(1)/usr/sbin
        $(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config
        $(INSTALL_DATA) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv
        $(INSTALL_BIN) ./files/etc/hotplug.d/net/99-batman-adv $(1)/etc/hotplug.d/net
+       $(INSTALL_BIN) ./files/etc/hotplug.d/iface/99-batman-adv $(1)/etc/hotplug.d/iface
        $(INSTALL_BIN) ./files/usr/sbin/batman-adv $(1)/usr/sbin
        $(BATCTL_INSTALL)
 endef
diff --git a/net/batman-adv/files/etc/hotplug.d/iface/99-batman-adv b/net/batman-adv/files/etc/hotplug.d/iface/99-batman-adv
new file mode 100644 (file)
index 0000000..9206c42
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+. /lib/batman-adv/config.sh
+
+bat_load_module
+config_load batman-adv
+
+case "$ACTION" in
+        ifup)
+                [ -d /sys/class/net/$DEVICE/batman_adv/ ] && config_foreach bat_add_interface mesh "$DEVICE"
+                ;;
+esac
index 42d4c2962dce19883b6e09a8c3494f3fd991d093..47132c107f7cfa99b3f749095ac3b766bbbf0dae 100644 (file)
@@ -8,7 +8,6 @@ config_load batman-adv
 case "$ACTION" in
        add)
                [ -d /sys/class/net/$INTERFACE/mesh/ ] && bat_config "$INTERFACE"
-               [ -d /sys/class/net/$INTERFACE/batman_adv/ ] && config_foreach bat_add_interface mesh "$INTERFACE"
                ;;
        remove)
                [ -d /sys/class/net/$INTERFACE/batman_adv/ ] && config_foreach bat_del_interface mesh "$INTERFACE"
index 35d61efbd7693478425add91fda9c1e890ce4ace..313dd3a0598c80f1c3f83a2248b98e3bd9a2a30c 100644 (file)
@@ -48,7 +48,6 @@ bat_add_interface()
        local interface="$2"
        local interfaces
 
-       sleep 3s # some device (ath) is very lazy to start
        config_get interfaces $mesh interfaces
        for iface in $interfaces; do
                [ -f "/sys/class/net/$iface/batman_adv/mesh_iface" ] || {