From: Marek Lindner Date: Mon, 26 Nov 2012 10:36:23 +0000 (+0000) Subject: batman-adv: fix race condition between iface add and iface up X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=a2d24f1e240c493e8d8f77fc529d4a85a992e0fd;p=openwrt%2Fsvn-archive%2Fpackages.git batman-adv: fix race condition between iface add and iface up Signed-off-by: Gui Iribarren Signed-off-by: Marek Lindner SVN-Revision: 34385 --- diff --git a/net/batman-adv/Makefile b/net/batman-adv/Makefile index f782ab7a5..50f8a574e 100644 --- a/net/batman-adv/Makefile +++ b/net/batman-adv/Makefile @@ -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 index 000000000..9206c424a --- /dev/null +++ b/net/batman-adv/files/etc/hotplug.d/iface/99-batman-adv @@ -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 diff --git a/net/batman-adv/files/etc/hotplug.d/net/99-batman-adv b/net/batman-adv/files/etc/hotplug.d/net/99-batman-adv index 42d4c2962..47132c107 100644 --- a/net/batman-adv/files/etc/hotplug.d/net/99-batman-adv +++ b/net/batman-adv/files/etc/hotplug.d/net/99-batman-adv @@ -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" diff --git a/net/batman-adv/files/lib/batman-adv/config.sh b/net/batman-adv/files/lib/batman-adv/config.sh index 35d61efbd..313dd3a05 100644 --- a/net/batman-adv/files/lib/batman-adv/config.sh +++ b/net/batman-adv/files/lib/batman-adv/config.sh @@ -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" ] || {