From 7ed34a52deb71582cd45d2402bb8a916fdcd1dcb Mon Sep 17 00:00:00 2001 From: Marek Lindner Date: Mon, 26 Nov 2012 10:36:23 +0000 Subject: [PATCH] batman-adv: fix race condition between iface add and iface up Signed-off-by: Gui Iribarren Signed-off-by: Marek Lindner git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/batman-adv@34385 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 3 ++- files/etc/hotplug.d/iface/99-batman-adv | 12 ++++++++++++ files/etc/hotplug.d/net/99-batman-adv | 1 - files/lib/batman-adv/config.sh | 1 - 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 files/etc/hotplug.d/iface/99-batman-adv diff --git a/Makefile b/Makefile index f782ab7..50f8a57 100644 --- a/Makefile +++ b/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/files/etc/hotplug.d/iface/99-batman-adv b/files/etc/hotplug.d/iface/99-batman-adv new file mode 100644 index 0000000..9206c42 --- /dev/null +++ b/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/files/etc/hotplug.d/net/99-batman-adv b/files/etc/hotplug.d/net/99-batman-adv index 42d4c29..47132c1 100644 --- a/files/etc/hotplug.d/net/99-batman-adv +++ b/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/files/lib/batman-adv/config.sh b/files/lib/batman-adv/config.sh index 35d61ef..313dd3a 100644 --- a/files/lib/batman-adv/config.sh +++ b/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" ] || { -- 2.30.2