Repository : ssh://git@open-mesh.org/openwrt-feed-batman-adv
On branch : master
commit 1e9acd6f93a736b8f3c1335b60ca6ce7962283ad Author: Filippo Sallemi tonyputi@gmail.com Date: Tue Apr 19 13:18:56 2011 +0000
batman-adv-devel: init script tries to retrieve interfaces from uci
The batman-adv init script will query uci (network.$iface.ifname) to retrieve the interface name to re-use the existing network configuration system. The default iface configuration (batman-adv.bat0.interfaces) is set to 'mesh' which allows to start batman-adv as soon as the network configuration contains a 'mesh' stanza.
Signed-off-by: Filippo Sallemi tonyputi@gmail.com Signed-off-by: Gioacchino Mazzurco gmazzurco89@gmail.com
1e9acd6f93a736b8f3c1335b60ca6ce7962283ad batman-adv-devel/files/etc/config/batman-adv | 2 +- batman-adv-devel/files/etc/init.d/batman-adv | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/batman-adv-devel/files/etc/config/batman-adv b/batman-adv-devel/files/etc/config/batman-adv index 9c66c93..31ef797 100644 --- a/batman-adv-devel/files/etc/config/batman-adv +++ b/batman-adv-devel/files/etc/config/batman-adv @@ -1,6 +1,6 @@
config 'mesh' 'bat0' - option 'interfaces' 'wlan0' + option 'interfaces' 'mesh' option 'aggregated_ogms' option 'bonding' option 'fragmentation' diff --git a/batman-adv-devel/files/etc/init.d/batman-adv b/batman-adv-devel/files/etc/init.d/batman-adv index 5011b6d..a6a8500 100644 --- a/batman-adv-devel/files/etc/init.d/batman-adv +++ b/batman-adv-devel/files/etc/init.d/batman-adv @@ -1,4 +1,6 @@ #!/bin/sh /etc/rc.common +# Copyright (C) 2011 OpenWrt.org + START=90
is_module_loaded() { @@ -36,8 +38,13 @@ start_mesh () { for interface in $interfaces do - [ ! -f "/sys/class/net/$interface/batman_adv/mesh_iface" ] && echo "Can't add interface $interface - ignoring" && continue - echo $meshif > /sys/class/net/$interface/batman_adv/mesh_iface + ifname=$(uci -P /var/state get network.$interface.ifname 2>&-) + [ ! -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] && { + ifname=${interface} + [ ! -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] && echo "Can't add interface $ifname - ignoring" && continue + } + + echo $meshif > /sys/class/net/$ifname/batman_adv/mesh_iface done
if [ $orig_interval ]; then @@ -86,7 +93,7 @@ stop_mesh() { for iface in $(ls /sys/class/net/*) do [ ! -f "$iface/batman_adv/mesh_iface" ] && continue - [ "$(head -1 $iface/batman_adv/mesh_iface)" != "status: $meshif" ] && continue + [ "$(head -1 $iface/batman_adv/mesh_iface)" != "$meshif" ] && continue
echo "none" > $iface/batman_adv/mesh_iface done