[OpenWrt-Devel] [PATCH] kmod-batman-adv: Use current /lib/functions/network.sh in hotplug.d scripts

2012-11-23 Thread Gui Iribarren
In legacy ubnt2 devices, when trying to bring 3 VAPs, one in adhoc
mode managed with batman-adv, a race condition occurs and /var/state
doesn't get the .ifname updated quickly enough at boot time. Using
(the newer) ubus call infrastructure overcomes the race condition.

Signed-off-by: Gui Iribarren g...@altermundi.net
---

~/openwrt/trunk/feeds/packages$ svn diff net/batman-adv
Index: net/batman-adv/files/lib/batman-adv/config.sh
===
--- net/batman-adv/files/lib/batman-adv/config.sh   (revision 34303)
+++ net/batman-adv/files/lib/batman-adv/config.sh   (working copy)
@@ -44,6 +44,8 @@

 bat_add_interface()
 {
+   . /lib/functions/network.sh
+
local mesh=$1
local interface=$2
local interfaces
@@ -52,7 +54,7 @@
config_get interfaces $mesh interfaces
for iface in $interfaces; do
[ -f /sys/class/net/$iface/batman_adv/mesh_iface ] || {
-   iface=$(uci -q -P/var/state get network.$iface.ifname)
+   network_get_physdev iface $iface
[ -f
/sys/class/net/$iface/batman_adv/mesh_iface ] || continue
}

@@ -62,6 +64,8 @@

 bat_del_interface()
 {
+   . /lib/functions/network.sh
+
local mesh=$1
local interface=$2
local interfaces
@@ -69,7 +73,7 @@
config_get interfaces $mesh interfaces
for iface in $interfaces; do
[ -f /sys/class/net/$iface/batman_adv/mesh_iface ] || {
-   iface=$(uci -q -P/var/state get network.$iface.ifname)
+   network_get_physdev iface $iface
[ -f
/sys/class/net/$iface/batman_adv/mesh_iface ] || continue
}
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] kmod-batman-adv: Use current /lib/functions/network.sh in hotplug.d scripts

2012-11-23 Thread Jonh Wendell
hi. why did you include that file twice? is there any reason to not do a
single include in the beginning of the the script?


2012/11/23 Gui Iribarren g...@altermundi.net

 In legacy ubnt2 devices, when trying to bring 3 VAPs, one in adhoc
 mode managed with batman-adv, a race condition occurs and /var/state
 doesn't get the .ifname updated quickly enough at boot time. Using
 (the newer) ubus call infrastructure overcomes the race condition.

 Signed-off-by: Gui Iribarren g...@altermundi.net
 ---

 ~/openwrt/trunk/feeds/packages$ svn diff net/batman-adv
 Index: net/batman-adv/files/lib/batman-adv/config.sh
 ===
 --- net/batman-adv/files/lib/batman-adv/config.sh   (revision 34303)
 +++ net/batman-adv/files/lib/batman-adv/config.sh   (working copy)
 @@ -44,6 +44,8 @@

  bat_add_interface()
  {
 +   . /lib/functions/network.sh
 +
 local mesh=$1
 local interface=$2
 local interfaces
 @@ -52,7 +54,7 @@
 config_get interfaces $mesh interfaces
 for iface in $interfaces; do
 [ -f /sys/class/net/$iface/batman_adv/mesh_iface ] || {
 -   iface=$(uci -q -P/var/state get
 network.$iface.ifname)
 +   network_get_physdev iface $iface
 [ -f
 /sys/class/net/$iface/batman_adv/mesh_iface ] || continue
 }

 @@ -62,6 +64,8 @@

  bat_del_interface()
  {
 +   . /lib/functions/network.sh
 +
 local mesh=$1
 local interface=$2
 local interfaces
 @@ -69,7 +73,7 @@
 config_get interfaces $mesh interfaces
 for iface in $interfaces; do
 [ -f /sys/class/net/$iface/batman_adv/mesh_iface ] || {
 -   iface=$(uci -q -P/var/state get
 network.$iface.ifname)
 +   network_get_physdev iface $iface
 [ -f
 /sys/class/net/$iface/batman_adv/mesh_iface ] || continue
 }
 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/mailman/listinfo/openwrt-devel




-- 
Jonh Wendell
http://www.bani.com.br
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] kmod-batman-adv: Use current /lib/functions/network.sh in hotplug.d scripts

2012-11-23 Thread Gui Iribarren
On Fri, Nov 23, 2012 at 7:11 AM, Jonh Wendell jonh.wend...@gmail.com wrote:
 hi. why did you include that file twice? is there any reason to not do a
 single include in the beginning of the the script?

Those two functions differ very little, and could probably be
refactored into one, but first i'll see what the package maintainer
thinks about it :)
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel