* [B.A.T.M.A.N.] [RFC] batman-adv boot setup scheme on OpenWRT @ 2012-11-23 12:52 Gui Iribarren 2012-11-23 14:00 ` Gui Iribarren 2012-11-25 17:12 ` Marek Lindner 0 siblings, 2 replies; 13+ messages in thread From: Gui Iribarren @ 2012-11-23 12:52 UTC (permalink / raw) To: The list for a Better Approach To Mobile Ad-hoc Networking Hello Marek and folks, chasing a race condition, I might have delved a little too deep into openwrt boot sequence :( AFAICU, currently there's a /etc/hotplug.d/net/99-batman-adv script which tries to configure both bat0 , and any interfaces coming up that might have to be included there. Problem is, hotplug.d/net scripts are called when interface is "added" but not necessarilly brought up yet. So there's a "sleep 3s" that works in most cases as a window for slow hardware bring up the interface. ...in most cases :( on an old nanoloco2, creating 2 wifi-ifaces in ap mode and 1 in ibss mode, managed with batman-adv, the sleep 3s is not enough. A 6s timeout works around it, but maybe there's a better solution? I've divided the script, putting the "add candidate interfaces to bat0" into /etc/hotplug.d/*iface*/99-batman-adv , which gets called precisely after an interface is actually brought up. This works as expected, and i could even eliminate the original 3s sleep. hotplug.d/iface script adds candidate interfaces to batX after they are brought up hotplug.d/net script configures batX as they appear, Would that work in general? Or was the single hotplug.d/net implemented that way, for a reason i'm missing? Thanks! Gui ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [B.A.T.M.A.N.] [RFC] batman-adv boot setup scheme on OpenWRT 2012-11-23 12:52 [B.A.T.M.A.N.] [RFC] batman-adv boot setup scheme on OpenWRT Gui Iribarren @ 2012-11-23 14:00 ` Gui Iribarren 2012-11-26 10:40 ` Marek Lindner 2012-11-25 17:12 ` Marek Lindner 1 sibling, 1 reply; 13+ messages in thread From: Gui Iribarren @ 2012-11-23 14:00 UTC (permalink / raw) To: The list for a Better Approach To Mobile Ad-hoc Networking Boring bootlog at http://pastebin.com/59FEPttY Proposed patch follows (against current batman-adv in openwrt 'packages' feed) Signed-off-by: Gui Iribarren <gui@altermundi.net> --- diff --git a/Makefile b/Makefile index d12665e..e37467f 100644 --- a/Makefile +++ b/Makefile @@ -113,9 +113,10 @@ define KernelPackage/batman-adv/conffiles 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/iface $(1)/etc/hotplug.d/net $(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/iface/99-batman-adv $(1)/etc/hotplug.d/iface $(INSTALL_BIN) ./files/etc/hotplug.d/net/99-batman-adv $(1)/etc/hotplug.d/net $(INSTALL_BIN) ./files/usr/sbin/batman-adv $(1)/usr/sbin $(BATCTL_INSTALL) 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..a4f4ed0 --- /dev/null +++ b/files/etc/hotplug.d/iface/99-batman-adv @@ -0,0 +1,15 @@ +#!/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" + ;; + ifdown) + [ -d /sys/class/net/$DEVICE/batman_adv/ ] && config_foreach bat_del_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..f0c391f 100644 --- a/files/etc/hotplug.d/net/99-batman-adv +++ b/files/etc/hotplug.d/net/99-batman-adv @@ -8,9 +8,5 @@ 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" ;; esac diff --git a/files/lib/batman-adv/config.sh b/files/lib/batman-adv/config.sh index cb78867..646e953 100644 --- a/files/lib/batman-adv/config.sh +++ b/files/lib/batman-adv/config.sh @@ -50,7 +50,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" ] || { ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [B.A.T.M.A.N.] [RFC] batman-adv boot setup scheme on OpenWRT 2012-11-23 14:00 ` Gui Iribarren @ 2012-11-26 10:40 ` Marek Lindner 2012-11-26 10:45 ` Sven Eckelmann 0 siblings, 1 reply; 13+ messages in thread From: Marek Lindner @ 2012-11-26 10:40 UTC (permalink / raw) To: b.a.t.m.a.n On Friday, November 23, 2012 22:00:47 Gui Iribarren wrote: > Boring bootlog at http://pastebin.com/59FEPttY > > Proposed patch follows (against current batman-adv in openwrt 'packages' > feed) > > Signed-off-by: Gui Iribarren <gui@altermundi.net> I made the necessary changes myself after I successfully de-scrambled your patch. You will find the patch in OpenWrt trunk. Give it try! Next time, please configure your mail client to not wrap lines. Thanks, Marek ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [B.A.T.M.A.N.] [RFC] batman-adv boot setup scheme on OpenWRT 2012-11-26 10:40 ` Marek Lindner @ 2012-11-26 10:45 ` Sven Eckelmann 2012-12-02 13:19 ` Gui Iribarren 0 siblings, 1 reply; 13+ messages in thread From: Sven Eckelmann @ 2012-11-26 10:45 UTC (permalink / raw) To: b.a.t.m.a.n [-- Attachment #1: Type: text/plain, Size: 617 bytes --] On Monday 26 November 2012 18:40:20 Marek Lindner wrote: > On Friday, November 23, 2012 22:00:47 Gui Iribarren wrote: > > Boring bootlog at http://pastebin.com/59FEPttY > > > > Proposed patch follows (against current batman-adv in openwrt 'packages' > > feed) > > > > Signed-off-by: Gui Iribarren <gui@altermundi.net> > > I made the necessary changes myself after I successfully de-scrambled your > patch. You will find the patch in OpenWrt trunk. Give it try! > Next time, please configure your mail client to not wrap lines. http://lxr.linux.no/linux+v2.6.30/Documentation/email-clients.txt Kind regards, Sven [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [B.A.T.M.A.N.] [RFC] batman-adv boot setup scheme on OpenWRT 2012-11-26 10:45 ` Sven Eckelmann @ 2012-12-02 13:19 ` Gui Iribarren 2012-12-09 11:10 ` Moritz Warning 0 siblings, 1 reply; 13+ messages in thread From: Gui Iribarren @ 2012-12-02 13:19 UTC (permalink / raw) To: The list for a Better Approach To Mobile Ad-hoc Networking [-- Attachment #1: Type: text/plain, Size: 2124 bytes --] Really Sorry for the whitespace headaches :( hope to get it straight this time. As we discussed on irc with Marek, here's a first stab at netifd integration. I'm surprised at how simple it actually is to add a custom "proto" with netifd No race condition with this approach, at least on the hardware i have at hand (ubnt2 , and tplinks) an example uci config scheme changes from batman-adv.bat0=mesh batman-adv.bat0.interfaces='mesh0 mesh1 mesh2' batman-adv.bat0.bridge_loop_avoidance=1 network.mesh{0,1,2}=interface network.mesh{0,1,2}.proto=none network.mesh{0,1,2}.mtu=1528 wireless.@wifi-iface[]=wifi-iface wireless.@wifi-iface[].network=mesh{0,1,2} wireless.@wifi-iface[].mode=adhoc to batman-adv.bat0=mesh batman-adv.bat0.bridge_loop_avoidance=1 network.mesh{0,1,2}=interface network.mesh{0,1,2}.proto=batadv network.mesh{0,1,2}.mesh=bat0 network.mesh{0,1,2}.mtu=1528 wireless.@wifi-iface[1]=wifi-iface wireless.@wifi-iface[1].network=mesh{0,1,2} wireless.@wifi-iface[1].mode=adhoc So /etc/config/batman-adv now deals only with bat0 tweakable parameters, /etc/config/network defines interfaces to be added to bat0 and /etc/config/wireless is unchanged and netifd is responsible of avoiding race conditions of course, this makes batman-adv package (on openwrt) depend on netifd, but openwrt devs are pushing it that way (and it's finally looking like an elegant move after all ;) ) Cheers! On Mon, Nov 26, 2012 at 7:45 AM, Sven Eckelmann <sven@narfation.org> wrote: > On Monday 26 November 2012 18:40:20 Marek Lindner wrote: >> On Friday, November 23, 2012 22:00:47 Gui Iribarren wrote: >> > Boring bootlog at http://pastebin.com/59FEPttY >> > >> > Proposed patch follows (against current batman-adv in openwrt 'packages' >> > feed) >> > >> > Signed-off-by: Gui Iribarren <gui@altermundi.net> >> >> I made the necessary changes myself after I successfully de-scrambled your >> patch. You will find the patch in OpenWrt trunk. Give it try! >> Next time, please configure your mail client to not wrap lines. > > http://lxr.linux.no/linux+v2.6.30/Documentation/email-clients.txt > > Kind regards, > Sven [-- Attachment #2: batman-adv-netifd-proto-batadv.patch --] [-- Type: application/octet-stream, Size: 3299 bytes --] diff --git a/files/etc/config/batman-adv b/files/etc/config/batman-adv index fb7b384..f775d80 100644 --- a/files/etc/config/batman-adv +++ b/files/etc/config/batman-adv @@ -1,6 +1,5 @@ config 'mesh' 'bat0' - option 'interfaces' 'mesh' option 'aggregated_ogms' option 'ap_isolation' option 'bonding' diff --git a/files/etc/hotplug.d/iface/99-batman-adv b/files/etc/hotplug.d/iface/99-batman-adv deleted file mode 100644 index 9206c42..0000000 --- a/files/etc/hotplug.d/iface/99-batman-adv +++ /dev/null @@ -1,12 +0,0 @@ -#!/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 47132c1..f0c391f 100644 --- a/files/etc/hotplug.d/net/99-batman-adv +++ b/files/etc/hotplug.d/net/99-batman-adv @@ -9,7 +9,4 @@ case "$ACTION" in add) [ -d /sys/class/net/$INTERFACE/mesh/ ] && bat_config "$INTERFACE" ;; - remove) - [ -d /sys/class/net/$INTERFACE/batman_adv/ ] && config_foreach bat_del_interface mesh "$INTERFACE" - ;; esac diff --git a/files/lib/batman-adv/config.sh b/files/lib/batman-adv/config.sh index 313dd3a..d0810b8 100644 --- a/files/lib/batman-adv/config.sh +++ b/files/lib/batman-adv/config.sh @@ -41,37 +41,3 @@ bat_config() [ -n "$ap_isolation" ] && echo $ap_isolation > /sys/class/net/$mesh/mesh/ap_isolation [ -n "$bridge_loop_avoidance" ] && echo $bridge_loop_avoidance > /sys/class/net/$mesh/mesh/bridge_loop_avoidance } - -bat_add_interface() -{ - local mesh="$1" - local interface="$2" - local interfaces - - 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) - [ -f "/sys/class/net/$iface/batman_adv/mesh_iface" ] || continue - } - - [ "$iface" = "$interface" ] && echo $mesh > /sys/class/net/$iface/batman_adv/mesh_iface - done -} - -bat_del_interface() -{ - local mesh="$1" - local interface="$2" - local interfaces - - 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) - [ -f "/sys/class/net/$iface/batman_adv/mesh_iface" ] || continue - } - - [ "$iface" = "$interface" ] && echo none > /sys/class/net/$iface/batman_adv/mesh_iface - done -} diff --git a/files/lib/netifd/proto/batadv.sh b/files/lib/netifd/proto/batadv.sh new file mode 100755 index 0000000..632a209 --- /dev/null +++ b/files/lib/netifd/proto/batadv.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +. /lib/functions.sh +. ../netifd-proto.sh +init_proto "$@" + +proto_batadv_init_config() { + proto_config_add_string "mesh" +} + +proto_batadv_setup() { + local config="$1" + local iface="$2" + + local mesh + json_get_vars mesh + + echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface" + proto_init_update "$iface" 1 + proto_send_update "$config" +} + +proto_batadv_teardown() { + local config="$1" + local iface="$2" + + echo "none" > "/sys/class/net/$iface/batman_adv/mesh_iface" || true +} + +add_protocol batadv ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [B.A.T.M.A.N.] [RFC] batman-adv boot setup scheme on OpenWRT 2012-12-02 13:19 ` Gui Iribarren @ 2012-12-09 11:10 ` Moritz Warning 2012-12-09 14:31 ` Marek Lindner 0 siblings, 1 reply; 13+ messages in thread From: Moritz Warning @ 2012-12-09 11:10 UTC (permalink / raw) To: b.a.t.m.a.n I have tried batman-adv-netifd-proto-batadv.patch along with some Makefile adjustments to get it compile. Afaict it works. On 12/02/2012 02:19 PM, Gui Iribarren wrote: > Really Sorry for the whitespace headaches :( hope to get it straight this time. > > As we discussed on irc with Marek, here's a first stab at netifd integration. > I'm surprised at how simple it actually is to add a custom "proto" with netifd > > No race condition with this approach, at least on the hardware i have > at hand (ubnt2 , and tplinks) > > an example uci config scheme changes from > > batman-adv.bat0=mesh > batman-adv.bat0.interfaces='mesh0 mesh1 mesh2' > batman-adv.bat0.bridge_loop_avoidance=1 > network.mesh{0,1,2}=interface > network.mesh{0,1,2}.proto=none > network.mesh{0,1,2}.mtu=1528 > wireless.@wifi-iface[]=wifi-iface > wireless.@wifi-iface[].network=mesh{0,1,2} > wireless.@wifi-iface[].mode=adhoc > > to > > batman-adv.bat0=mesh > batman-adv.bat0.bridge_loop_avoidance=1 > network.mesh{0,1,2}=interface > network.mesh{0,1,2}.proto=batadv > network.mesh{0,1,2}.mesh=bat0 > network.mesh{0,1,2}.mtu=1528 > wireless.@wifi-iface[1]=wifi-iface > wireless.@wifi-iface[1].network=mesh{0,1,2} > wireless.@wifi-iface[1].mode=adhoc > > So /etc/config/batman-adv now deals only with bat0 tweakable parameters, > /etc/config/network defines interfaces to be added to bat0 > and /etc/config/wireless is unchanged > > and netifd is responsible of avoiding race conditions > of course, this makes batman-adv package (on openwrt) depend on > netifd, but openwrt devs are pushing it that way (and it's finally > looking like an elegant move after all ;) ) > > Cheers! > > On Mon, Nov 26, 2012 at 7:45 AM, Sven Eckelmann <sven@narfation.org> wrote: >> On Monday 26 November 2012 18:40:20 Marek Lindner wrote: >>> On Friday, November 23, 2012 22:00:47 Gui Iribarren wrote: >>>> Boring bootlog at http://pastebin.com/59FEPttY >>>> >>>> Proposed patch follows (against current batman-adv in openwrt 'packages' >>>> feed) >>>> >>>> Signed-off-by: Gui Iribarren <gui@altermundi.net> >>> >>> I made the necessary changes myself after I successfully de-scrambled your >>> patch. You will find the patch in OpenWrt trunk. Give it try! >>> Next time, please configure your mail client to not wrap lines. >> >> http://lxr.linux.no/linux+v2.6.30/Documentation/email-clients.txt >> >> Kind regards, >> Sven ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [B.A.T.M.A.N.] [RFC] batman-adv boot setup scheme on OpenWRT 2012-12-09 11:10 ` Moritz Warning @ 2012-12-09 14:31 ` Marek Lindner 2012-12-09 16:03 ` Moritz Warning 0 siblings, 1 reply; 13+ messages in thread From: Marek Lindner @ 2012-12-09 14:31 UTC (permalink / raw) To: b.a.t.m.a.n On Sunday, December 09, 2012 19:10:56 Moritz Warning wrote: > I have tried batman-adv-netifd-proto-batadv.patch along with some Makefile > adjustments to get it compile. Afaict it works. Thanks for testing! Do you mind sharing & explaining these changes ? Would be a good idea to push the working variant, don't you think ? Cheers, Marek ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [B.A.T.M.A.N.] [RFC] batman-adv boot setup scheme on OpenWRT 2012-12-09 14:31 ` Marek Lindner @ 2012-12-09 16:03 ` Moritz Warning 2012-12-09 16:20 ` Antonio Quartulli ` (2 more replies) 0 siblings, 3 replies; 13+ messages in thread From: Moritz Warning @ 2012-12-09 16:03 UTC (permalink / raw) To: b.a.t.m.a.n [-- Attachment #1: Type: text/plain, Size: 486 bytes --] Here you go. :) It would be good idea if Gui had a look at it before it is applied. On 12/09/2012 03:31 PM, Marek Lindner wrote: > On Sunday, December 09, 2012 19:10:56 Moritz Warning wrote: >> I have tried batman-adv-netifd-proto-batadv.patch along with some Makefile >> adjustments to get it compile. Afaict it works. > Thanks for testing! Do you mind sharing & explaining these changes ? Would be > a good idea to push the working variant, don't you think ? > > Cheers, > Marek > [-- Attachment #2: batman-adv-netifd-proto-batadv.patch --] [-- Type: text/x-patch, Size: 5367 bytes --] From d37c189ef8d87e44d2d6a28bbae0c960147d2098 Mon Sep 17 00:00:00 2001 From: Moritz Warning <moritzwarning@web.de> Date: Sun, 9 Dec 2012 16:57:04 +0100 Subject: [PATCH] batman-adv netifd proto batadv --- batman-adv-devel/Makefile | 4 +-- batman-adv-devel/files/etc/config/batman-adv | 1 - .../files/etc/hotplug.d/iface/99-batman-adv | 12 ------- .../files/etc/hotplug.d/net/99-batman-adv | 3 -- batman-adv-devel/files/lib/batman-adv/config.sh | 34 -------------------- batman-adv-devel/files/lib/netifd/proto/batadv.sh | 30 +++++++++++++++++ 6 files changed, 32 insertions(+), 52 deletions(-) delete mode 100644 batman-adv-devel/files/etc/hotplug.d/iface/99-batman-adv create mode 100644 batman-adv-devel/files/lib/netifd/proto/batadv.sh diff --git a/batman-adv-devel/Makefile b/batman-adv-devel/Makefile index e80b49a..7bbb75e 100644 --- a/batman-adv-devel/Makefile +++ b/batman-adv-devel/Makefile @@ -113,11 +113,11 @@ define Build/Clean endef define KernelPackage/batman-adv-devel/install - $(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/net $(1)/etc/hotplug.d/iface $(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 $(1)/lib/netifd/proto $(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/lib/netifd/proto/batadv.sh $(1)/lib/netifd/proto $(INSTALL_BIN) ./files/usr/sbin/batman-adv $(1)/usr/sbin $(BATCTL_INSTALL) endef diff --git a/batman-adv-devel/files/etc/config/batman-adv b/batman-adv-devel/files/etc/config/batman-adv index 6ec9e03..6a62203 100644 --- a/batman-adv-devel/files/etc/config/batman-adv +++ b/batman-adv-devel/files/etc/config/batman-adv @@ -1,6 +1,5 @@ config 'mesh' 'bat0' - option 'interfaces' 'mesh' option 'aggregated_ogms' option 'ap_isolation' option 'bonding' diff --git a/batman-adv-devel/files/etc/hotplug.d/iface/99-batman-adv b/batman-adv-devel/files/etc/hotplug.d/iface/99-batman-adv deleted file mode 100644 index 9206c42..0000000 --- a/batman-adv-devel/files/etc/hotplug.d/iface/99-batman-adv +++ /dev/null @@ -1,12 +0,0 @@ -#!/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/batman-adv-devel/files/etc/hotplug.d/net/99-batman-adv b/batman-adv-devel/files/etc/hotplug.d/net/99-batman-adv index 47132c1..f0c391f 100644 --- a/batman-adv-devel/files/etc/hotplug.d/net/99-batman-adv +++ b/batman-adv-devel/files/etc/hotplug.d/net/99-batman-adv @@ -9,7 +9,4 @@ case "$ACTION" in add) [ -d /sys/class/net/$INTERFACE/mesh/ ] && bat_config "$INTERFACE" ;; - remove) - [ -d /sys/class/net/$INTERFACE/batman_adv/ ] && config_foreach bat_del_interface mesh "$INTERFACE" - ;; esac diff --git a/batman-adv-devel/files/lib/batman-adv/config.sh b/batman-adv-devel/files/lib/batman-adv/config.sh index 5260c01..ae102e9 100644 --- a/batman-adv-devel/files/lib/batman-adv/config.sh +++ b/batman-adv-devel/files/lib/batman-adv/config.sh @@ -44,37 +44,3 @@ bat_config() [ -n "$orig_interval" ] && echo $orig_interval > /sys/class/net/$mesh/mesh/orig_interval [ -n "$vis_mode" ] && echo $vis_mode > /sys/class/net/$mesh/mesh/vis_mode } - -bat_add_interface() -{ - local mesh="$1" - local interface="$2" - local interfaces - - 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) - [ -f "/sys/class/net/$iface/batman_adv/mesh_iface" ] || continue - } - - [ "$iface" = "$interface" ] && echo $mesh > /sys/class/net/$iface/batman_adv/mesh_iface - done -} - -bat_del_interface() -{ - local mesh="$1" - local interface="$2" - local interfaces - - 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) - [ -f "/sys/class/net/$iface/batman_adv/mesh_iface" ] || continue - } - - [ "$iface" = "$interface" ] && echo none > /sys/class/net/$iface/batman_adv/mesh_iface - done -} diff --git a/batman-adv-devel/files/lib/netifd/proto/batadv.sh b/batman-adv-devel/files/lib/netifd/proto/batadv.sh new file mode 100644 index 0000000..632a209 --- /dev/null +++ b/batman-adv-devel/files/lib/netifd/proto/batadv.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +. /lib/functions.sh +. ../netifd-proto.sh +init_proto "$@" + +proto_batadv_init_config() { + proto_config_add_string "mesh" +} + +proto_batadv_setup() { + local config="$1" + local iface="$2" + + local mesh + json_get_vars mesh + + echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface" + proto_init_update "$iface" 1 + proto_send_update "$config" +} + +proto_batadv_teardown() { + local config="$1" + local iface="$2" + + echo "none" > "/sys/class/net/$iface/batman_adv/mesh_iface" || true +} + +add_protocol batadv -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [B.A.T.M.A.N.] [RFC] batman-adv boot setup scheme on OpenWRT 2012-12-09 16:03 ` Moritz Warning @ 2012-12-09 16:20 ` Antonio Quartulli 2012-12-09 16:35 ` Gui Iribarren 2012-12-09 16:50 ` Moritz Warning 2 siblings, 0 replies; 13+ messages in thread From: Antonio Quartulli @ 2012-12-09 16:20 UTC (permalink / raw) To: The list for a Better Approach To Mobile Ad-hoc Networking [-- Attachment #1: Type: text/plain, Size: 548 bytes --] On Sun, Dec 09, 2012 at 05:03:11PM +0100, Moritz Warning wrote: > Here you go. :) > It would be good idea if Gui had a look at it before it is applied. > Hey Moritz, remember that this should all be GPLed stuff, therefore you sign is mandatory on this patch :) And since you are following up a patch from Gui, it would be nice if you could reuse the same commit message (or rearrange it..as you wish) and keep his sign as well. Cheers, -- Antonio Quartulli ..each of us alone is worth nothing.. Ernesto "Che" Guevara [-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [B.A.T.M.A.N.] [RFC] batman-adv boot setup scheme on OpenWRT 2012-12-09 16:03 ` Moritz Warning 2012-12-09 16:20 ` Antonio Quartulli @ 2012-12-09 16:35 ` Gui Iribarren 2012-12-10 0:13 ` Jo-Philipp Wich 2012-12-09 16:50 ` Moritz Warning 2 siblings, 1 reply; 13+ messages in thread From: Gui Iribarren @ 2012-12-09 16:35 UTC (permalink / raw) To: The list for a Better Approach To Mobile Ad-hoc Networking Didn't test it but gave a quick glance, looks good to me :) I'd also add 'netifd' as a dependency in the makefile (and, well, increase the pkg revision, but that's marek job) Thanks a lot! On Sun, Dec 9, 2012 at 1:03 PM, Moritz Warning <moritzwarning@web.de> wrote: > Here you go. :) > It would be good idea if Gui had a look at it before it is applied. > > On 12/09/2012 03:31 PM, Marek Lindner wrote: >> On Sunday, December 09, 2012 19:10:56 Moritz Warning wrote: >>> I have tried batman-adv-netifd-proto-batadv.patch along with some Makefile >>> adjustments to get it compile. Afaict it works. >> Thanks for testing! Do you mind sharing & explaining these changes ? Would be >> a good idea to push the working variant, don't you think ? >> >> Cheers, >> Marek >> > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [B.A.T.M.A.N.] [RFC] batman-adv boot setup scheme on OpenWRT 2012-12-09 16:35 ` Gui Iribarren @ 2012-12-10 0:13 ` Jo-Philipp Wich 0 siblings, 0 replies; 13+ messages in thread From: Jo-Philipp Wich @ 2012-12-10 0:13 UTC (permalink / raw) To: b.a.t.m.a.n -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi. > I'd also add 'netifd' as a dependency in the makefile You could but I do not think it is necessary. kmod-batman-adv works well without netifd, the onyl thing that would break is the support scripts. Also netifd is pretty much guranteed to be present in current release so you can rely on it, but people who do not have it installed for wahtever reason might still want to use the batman kernel module, so I'd opt for not making it a hard dependency. Cheers, Jow -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with undefined - http://www.enigmail.net/ iEYEARECAAYFAlDFKTcACgkQdputYINPTPMRrwCcDBW58q62Jm7lJKIywuLX7B15 59MAn3G4pLJUn7ACt5iTxBpOx8qjS7E4 =btbj -----END PGP SIGNATURE----- ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [B.A.T.M.A.N.] [RFC] batman-adv boot setup scheme on OpenWRT 2012-12-09 16:03 ` Moritz Warning 2012-12-09 16:20 ` Antonio Quartulli 2012-12-09 16:35 ` Gui Iribarren @ 2012-12-09 16:50 ` Moritz Warning 2 siblings, 0 replies; 13+ messages in thread From: Moritz Warning @ 2012-12-09 16:50 UTC (permalink / raw) To: b.a.t.m.a.n On 12/09/2012 05:03 PM, Moritz Warning wrote: > Here you go. :) > It would be good idea if Gui had a look at it before it is applied. > > On 12/09/2012 03:31 PM, Marek Lindner wrote: >> On Sunday, December 09, 2012 19:10:56 Moritz Warning wrote: >>> I have tried batman-adv-netifd-proto-batadv.patch along with some Makefile >>> adjustments to get it compile. Afaict it works. >> Thanks for testing! Do you mind sharing & explaining these changes ? Would be >> a good idea to push the working variant, don't you think ? >> >> Cheers, >> Marek >> > The patch only adds necessary Makefile changes. It has to be GPL since Guis patch is GPL (afaik) as well. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [B.A.T.M.A.N.] [RFC] batman-adv boot setup scheme on OpenWRT 2012-11-23 12:52 [B.A.T.M.A.N.] [RFC] batman-adv boot setup scheme on OpenWRT Gui Iribarren 2012-11-23 14:00 ` Gui Iribarren @ 2012-11-25 17:12 ` Marek Lindner 1 sibling, 0 replies; 13+ messages in thread From: Marek Lindner @ 2012-11-25 17:12 UTC (permalink / raw) To: The list for a Better Approach To Mobile Ad-hoc Networking Hi, > AFAICU, currently there's a /etc/hotplug.d/net/99-batman-adv script > which tries to configure both bat0 , and any interfaces coming up that > might have to be included there. Problem is, hotplug.d/net scripts are > called when interface is "added" but not necessarilly brought up yet. > So there's a "sleep 3s" that works in most cases as a window for slow > hardware bring up the interface. I like the idea of using the iface "ifup" hook for adding hard-interfaces. On the other hand I opt for keeping the net "remove" hook for removing them because batman-adv handles these ifup/ifdown blips internally. If you adjust that part I'll will merge your patch. Excellent catch! Cheers, Marek ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2012-12-10 0:13 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-11-23 12:52 [B.A.T.M.A.N.] [RFC] batman-adv boot setup scheme on OpenWRT Gui Iribarren 2012-11-23 14:00 ` Gui Iribarren 2012-11-26 10:40 ` Marek Lindner 2012-11-26 10:45 ` Sven Eckelmann 2012-12-02 13:19 ` Gui Iribarren 2012-12-09 11:10 ` Moritz Warning 2012-12-09 14:31 ` Marek Lindner 2012-12-09 16:03 ` Moritz Warning 2012-12-09 16:20 ` Antonio Quartulli 2012-12-09 16:35 ` Gui Iribarren 2012-12-10 0:13 ` Jo-Philipp Wich 2012-12-09 16:50 ` Moritz Warning 2012-11-25 17:12 ` Marek Lindner
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox