* [B.A.T.M.A.N.] Fwd: /lib/batman-adv/config.sh
[not found] ` <201202111808.54341.lindner_marek@yahoo.de>
@ 2012-02-26 17:49 ` Filippo Sallemi
2012-02-26 17:50 ` [B.A.T.M.A.N.] /lib/batman-adv/config.sh Filippo Sallemi
2012-02-27 8:11 ` [B.A.T.M.A.N.] Fwd: /lib/batman-adv/config.sh Marek Lindner
0 siblings, 2 replies; 8+ messages in thread
From: Filippo Sallemi @ 2012-02-26 17:49 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
Ok in this email my proposal patch.
I've to sleep 4s if you have an ap + adhoc vifs.
[ "$(echo $interface | awk '$0 ~ /^wlan[0-9]*/')" ] && sleep 4s
For convenience I sleep only if an wlan was triggered. If you have
only one interface in adhoc mode per radio 3 seconds are enought.
bye
---------- Messaggio inoltrato ----------
Da: Marek Lindner <lindner_marek@yahoo.de>
Date: 11 febbraio 2012 11:08
Oggetto: Re: /lib/batman-adv/config.sh
A: Filippo Sallemi <tonyputi@gmail.com>
On Friday, February 10, 2012 01:21:21 you wrote:
> > Yeah - looks good.
> > I still don't get why we don't need to wait 3/5 seconds anymore. Can you
> > explain this ?
>
> No i'm wrong we need to wait 3 seconds... i think that the sleep call
> could be moved to hotplug.d/99-batman-adv when an interface is added
> to mesh interface.
> I need some time.
Ok - I left the "sleep 3s" in the file. I applied your config_bat/bat_config
as well as the forgotten ap_isolation config fix.
Since the for loop does not fix the wait problem why do you wish to change it?
I am referring to your suggested change:
# Load network config here just in case!
config_load network
for iface in $interfaces; do
# copy iface into ifname
local ifname=$iface
[ -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] || {
# if ifname was not found try to find it via uci config
config_get ifname $iface ifname
[ -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] ||
continue
}
[ "$ifname" = "$interface" ] && echo $mesh >
/sys/class/net/$ifname/batman_adv/mesh_iface
done
bat_add_interface() and bat_del_interface() have the same loop but we only
change one ? The only difference I can see is another added variable and not
calling "uci -q -P/var/state get network.$iface.ifname". Why ?
Cheers,
Marek
--
Filippo Sallemi
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [B.A.T.M.A.N.] /lib/batman-adv/config.sh
2012-02-26 17:49 ` [B.A.T.M.A.N.] Fwd: /lib/batman-adv/config.sh Filippo Sallemi
@ 2012-02-26 17:50 ` Filippo Sallemi
2012-02-27 8:11 ` [B.A.T.M.A.N.] Fwd: /lib/batman-adv/config.sh Marek Lindner
1 sibling, 0 replies; 8+ messages in thread
From: Filippo Sallemi @ 2012-02-26 17:50 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
[-- Attachment #1: Type: text/plain, Size: 2201 bytes --]
oopps. I've miss the files
Il 26 febbraio 2012 18:49, Filippo Sallemi <tonyputi@gmail.com> ha scritto:
> Ok in this email my proposal patch.
> I've to sleep 4s if you have an ap + adhoc vifs.
>
> [ "$(echo $interface | awk '$0 ~ /^wlan[0-9]*/')" ] && sleep 4s
>
> For convenience I sleep only if an wlan was triggered. If you have
> only one interface in adhoc mode per radio 3 seconds are enought.
>
> bye
>
> ---------- Messaggio inoltrato ----------
> Da: Marek Lindner <lindner_marek@yahoo.de>
> Date: 11 febbraio 2012 11:08
> Oggetto: Re: /lib/batman-adv/config.sh
> A: Filippo Sallemi <tonyputi@gmail.com>
>
>
> On Friday, February 10, 2012 01:21:21 you wrote:
>> > Yeah - looks good.
>> > I still don't get why we don't need to wait 3/5 seconds anymore. Can you
>> > explain this ?
>>
>> No i'm wrong we need to wait 3 seconds... i think that the sleep call
>> could be moved to hotplug.d/99-batman-adv when an interface is added
>> to mesh interface.
>> I need some time.
>
> Ok - I left the "sleep 3s" in the file. I applied your config_bat/bat_config
> as well as the forgotten ap_isolation config fix.
>
> Since the for loop does not fix the wait problem why do you wish to change it?
> I am referring to your suggested change:
>
> # Load network config here just in case!
> config_load network
> for iface in $interfaces; do
> # copy iface into ifname
> local ifname=$iface
> [ -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] || {
> # if ifname was not found try to find it via uci config
> config_get ifname $iface ifname
> [ -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] ||
> continue
> }
>
> [ "$ifname" = "$interface" ] && echo $mesh >
> /sys/class/net/$ifname/batman_adv/mesh_iface
> done
>
> bat_add_interface() and bat_del_interface() have the same loop but we only
> change one ? The only difference I can see is another added variable and not
> calling "uci -q -P/var/state get network.$iface.ifname". Why ?
>
> Cheers,
> Marek
>
>
> --
> Filippo Sallemi
--
Filippo Sallemi
[-- Attachment #2: files.tar.gz --]
[-- Type: application/x-gzip, Size: 3475 bytes --]
[-- Attachment #3: batman-adv.patch --]
[-- Type: text/x-patch, Size: 3729 bytes --]
Index: lib/batman-adv/config.sh
===================================================================
--- lib/batman-adv/config.sh (revisione 30733)
+++ lib/batman-adv/config.sh (copia locale)
@@ -14,6 +14,7 @@
config_get orig_interval "$mesh" orig_interval
config_get hop_penalty "$mesh" hop_penalty
config_get vis_mode "$mesh" vis_mode
+ config_get ap_isolation "$mesh" ap_isolation
[ -n "$orig_interval" ] && echo $orig_interval > /sys/class/net/$mesh/mesh/orig_interval
[ -n "$hop_penalty" ] && echo $hop_penalty > /sys/class/net/$mesh/mesh/hop_penalty
@@ -25,22 +26,27 @@
[ -n "$gw_mode" ] && echo $gw_mode > /sys/class/net/$mesh/mesh/gw_mode
[ -n "$gw_sel_class" ] && echo $gw_sel_class > /sys/class/net/$mesh/mesh/gw_sel_class
[ -n "$vis_mode" ] && echo $vis_mode > /sys/class/net/$mesh/mesh/vis_mode
+ [ -n "$ap_isolation" ] && echo $ap_isolation > /sys/class/net/$mesh/mesh/ap_isolation
}
bat_add_interface(){
local mesh="$1"
local interface="$2"
- local interfaces
-
- sleep 3s # some device (ath) is very lazy to start
+ local iface interfaces
+
config_get interfaces $mesh interfaces
+
+ [ "$(echo $interface | awk '$0 ~ /^wlan[0-9]*/')" ] && sleep 4s
+ # Load network config here just in case!
+ config_load network
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
+ local ifname="$iface"
+ [ -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] || {
+ config_get ifname $iface ifname
+ [ -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] || continue
}
-
- [ "$iface" = "$interface" ] && echo $mesh > /sys/class/net/$iface/batman_adv/mesh_iface
+
+ [ "$ifname" = "$interface" ] && echo $mesh > /sys/class/net/$ifname/batman_adv/mesh_iface
done
}
@@ -50,12 +56,16 @@
local interfaces
config_get interfaces $mesh interfaces
+
+ # Load network config here just in case!
+ config_load network
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
+ local ifname="$iface"
+ [ -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] || {
+ config_get ifname $iface ifname
+ [ -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] || continue
}
- [ "$iface" = "$interface" ] && echo none > /sys/class/net/$iface/batman_adv/mesh_iface
+ [ "$ifname" = "$interface" ] && echo none > /sys/class/net/$ifname/batman_adv/mesh_iface
done
}
Index: usr/sbin/batman-adv
===================================================================
--- usr/sbin/batman-adv (revisione 30733)
+++ usr/sbin/batman-adv (copia locale)
@@ -1,6 +1,7 @@
-#!/bin/sh /etc/rc.common
+#!/bin/sh
# Copyright (C) 2011 OpenWrt.org
+. /etc/functions.sh
. /lib/batman-adv/config.sh
start_mesh() {
@@ -44,3 +45,15 @@
config_foreach stop_mesh mesh
fi
}
+
+restart() {
+ stop $1
+ start $1
+}
+
+case "$1" in
+ start) start $2 ;;
+ stop) stop $2 ;;
+ restart) restart $2 ;;
+ *) echo "Usage: batman-adv <start|stop|restart> [mesh]"
+esac
Index: etc/hotplug.d/net/99-batman-adv
===================================================================
--- etc/hotplug.d/net/99-batman-adv (revisione 30733)
+++ etc/hotplug.d/net/99-batman-adv (copia locale)
@@ -6,7 +6,7 @@
case "$ACTION" in
add)
- [ -d /sys/class/net/$INTERFACE/mesh/ ] && config_bat "$INTERFACE"
+ [ -d /sys/class/net/$INTERFACE/mesh/ ] && bat_config "$INTERFACE"
[ -d /sys/class/net/$INTERFACE/batman_adv/ ] && config_foreach bat_add_interface mesh "$INTERFACE"
;;
remove)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [B.A.T.M.A.N.] Fwd: /lib/batman-adv/config.sh
2012-02-26 17:49 ` [B.A.T.M.A.N.] Fwd: /lib/batman-adv/config.sh Filippo Sallemi
2012-02-26 17:50 ` [B.A.T.M.A.N.] /lib/batman-adv/config.sh Filippo Sallemi
@ 2012-02-27 8:11 ` Marek Lindner
2012-02-27 12:42 ` Filippo Sallemi
1 sibling, 1 reply; 8+ messages in thread
From: Marek Lindner @ 2012-02-27 8:11 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Monday, February 27, 2012 01:49:44 Filippo Sallemi wrote:
> Ok in this email my proposal patch.
> I've to sleep 4s if you have an ap + adhoc vifs.
>
> [ "$(echo $interface | awk '$0 ~ /^wlan[0-9]*/')" ] && sleep 4s
>
> For convenience I sleep only if an wlan was triggered. If you have
> only one interface in adhoc mode per radio 3 seconds are enought.
What if somebody calls his interfaces in a different way ? As you know the
name can freely be chosen.
Regards,
Marek
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [B.A.T.M.A.N.] Fwd: /lib/batman-adv/config.sh
2012-02-27 8:11 ` [B.A.T.M.A.N.] Fwd: /lib/batman-adv/config.sh Marek Lindner
@ 2012-02-27 12:42 ` Filippo Sallemi
2012-02-28 5:44 ` Marek Lindner
0 siblings, 1 reply; 8+ messages in thread
From: Filippo Sallemi @ 2012-02-27 12:42 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
Il 27 febbraio 2012 09:11, Marek Lindner <lindner_marek@yahoo.de> ha scritto:
> On Monday, February 27, 2012 01:49:44 Filippo Sallemi wrote:
>> Ok in this email my proposal patch.
>> I've to sleep 4s if you have an ap + adhoc vifs.
>>
>> [ "$(echo $interface | awk '$0 ~ /^wlan[0-9]*/')" ] && sleep 4s
>>
>> For convenience I sleep only if an wlan was triggered. If you have
>> only one interface in adhoc mode per radio 3 seconds are enought.
>
> What if somebody calls his interfaces in a different way ? As you know the
> name can freely be chosen.
You can chose another name instead of wlan0 wlan0-1 wlan1 wlan1-1 eth0 eth1 ...?
This line is executed only when hotplug is called on network restart
and so when every interface is triggered.
when eth0 is added we don't sleep but when if wlan0 is triggered then
we sleep 4 seconds because the real state of the interface and so the
real name of your logical network take some time to be ready.
>
> Regards,
> Marek
Rgds
--
Filippo Sallemi
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [B.A.T.M.A.N.] Fwd: /lib/batman-adv/config.sh
2012-02-27 12:42 ` Filippo Sallemi
@ 2012-02-28 5:44 ` Marek Lindner
2012-02-28 8:06 ` Filippo Sallemi
0 siblings, 1 reply; 8+ messages in thread
From: Marek Lindner @ 2012-02-28 5:44 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Monday, February 27, 2012 20:42:58 Filippo Sallemi wrote:
> Il 27 febbraio 2012 09:11, Marek Lindner <lindner_marek@yahoo.de> ha
scritto:
> > On Monday, February 27, 2012 01:49:44 Filippo Sallemi wrote:
> >> Ok in this email my proposal patch.
> >> I've to sleep 4s if you have an ap + adhoc vifs.
> >>
> >> [ "$(echo $interface | awk '$0 ~ /^wlan[0-9]*/')" ] && sleep 4s
> >>
> >> For convenience I sleep only if an wlan was triggered. If you have
> >> only one interface in adhoc mode per radio 3 seconds are enought.
> >
> > What if somebody calls his interfaces in a different way ? As you know
> > the name can freely be chosen.
>
> You can chose another name instead of wlan0 wlan0-1 wlan1 wlan1-1 eth0 eth1
> ...?
Yes, you can. I thought you were doing it to after I saw your config:
config 'mesh' 'mesh'
option 'interfaces' 'msh0'
msh0 does not look like wlanX at all, wouldn't you say so ?
Cheers,
Marek
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [B.A.T.M.A.N.] Fwd: /lib/batman-adv/config.sh
2012-02-28 5:44 ` Marek Lindner
@ 2012-02-28 8:06 ` Filippo Sallemi
2012-02-28 8:21 ` Marek Lindner
0 siblings, 1 reply; 8+ messages in thread
From: Filippo Sallemi @ 2012-02-28 8:06 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
Ok but i' dont wait for this. Hotplug was called when a new interface
is added. msh0 is no a real interface so when wlan0 is added I sleep 4
seconds and check if wlan0 is part o batman-adv interfaces.
Rgds
Il 28 febbraio 2012 06:44, Marek Lindner <lindner_marek@yahoo.de> ha scritto:
> On Monday, February 27, 2012 20:42:58 Filippo Sallemi wrote:
>> Il 27 febbraio 2012 09:11, Marek Lindner <lindner_marek@yahoo.de> ha
> scritto:
>> > On Monday, February 27, 2012 01:49:44 Filippo Sallemi wrote:
>> >> Ok in this email my proposal patch.
>> >> I've to sleep 4s if you have an ap + adhoc vifs.
>> >>
>> >> [ "$(echo $interface | awk '$0 ~ /^wlan[0-9]*/')" ] && sleep 4s
>> >>
>> >> For convenience I sleep only if an wlan was triggered. If you have
>> >> only one interface in adhoc mode per radio 3 seconds are enought.
>> >
>> > What if somebody calls his interfaces in a different way ? As you know
>> > the name can freely be chosen.
>>
>> You can chose another name instead of wlan0 wlan0-1 wlan1 wlan1-1 eth0 eth1
>> ...?
>
> Yes, you can. I thought you were doing it to after I saw your config:
>
> config 'mesh' 'mesh'
> option 'interfaces' 'msh0'
>
> msh0 does not look like wlanX at all, wouldn't you say so ?
>
> Cheers,
> Marek
--
Filippo Sallemi
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [B.A.T.M.A.N.] Fwd: /lib/batman-adv/config.sh
2012-02-28 8:06 ` Filippo Sallemi
@ 2012-02-28 8:21 ` Marek Lindner
2012-02-28 10:36 ` Filippo Sallemi
0 siblings, 1 reply; 8+ messages in thread
From: Marek Lindner @ 2012-02-28 8:21 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Tuesday, February 28, 2012 16:06:44 Filippo Sallemi wrote:
> Ok but i' dont wait for this. Hotplug was called when a new interface
> is added. msh0 is no a real interface so when wlan0 is added I sleep 4
> seconds and check if wlan0 is part o batman-adv interfaces.
Sorry, I don't understand. What do you mean with "msh0" is not a real
interface ? The part about wlan0 I understand - the question was what happens
if the interface is not named wlan0?
This could be your wireless config file:
config 'wifi-iface'
option 'device' 'radio0'
option 'ifname' 'msh0'
option 'mode' 'adhoc'
option 'ssid' 'mesh'
Cheers,
Marek
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [B.A.T.M.A.N.] Fwd: /lib/batman-adv/config.sh
2012-02-28 8:21 ` Marek Lindner
@ 2012-02-28 10:36 ` Filippo Sallemi
0 siblings, 0 replies; 8+ messages in thread
From: Filippo Sallemi @ 2012-02-28 10:36 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
Il 28 febbraio 2012 09:21, Marek Lindner <lindner_marek@yahoo.de> ha scritto:
> On Tuesday, February 28, 2012 16:06:44 Filippo Sallemi wrote:
>> Ok but i' dont wait for this. Hotplug was called when a new interface
>> is added. msh0 is no a real interface so when wlan0 is added I sleep 4
>> seconds and check if wlan0 is part o batman-adv interfaces.
>
> Sorry, I don't understand. What do you mean with "msh0" is not a real
> interface ?
That msh0 is the name of logical network and wlan0 is the real name of
physical interface.
The part about wlan0 I understand - the question was what happens
> if the interface is not named wlan0?
yes. if in your batman-adv interface you put wlan0 (the real interface
name) you don't have to sleep.
The problem is that hotplug.d, when a new interface was added, at
99-batman-adv script time it try to check if the new interface (es.
wlan0) is part of batman-adv interface definitions so now if in your
batman-adv config file you have msh0, the script try to find the real
interface name of msh0 and it fail because it is not be knowned at
this time. The only way to get it to work properly is to wait for some
seconds (3 seconds if you have only one vif, 4 for 2 interface es
adhoc + ap).
>
> This could be your wireless config file:
> config 'wifi-iface'
> option 'device' 'radio0'
> option 'ifname' 'msh0'
> option 'mode' 'adhoc'
> option 'ssid' 'mesh'
>
> Cheers,
> Marek
Bye
--
Filippo Sallemi
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-02-28 10:36 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CAFevQmN-RVQookzL-M9_G0xGKJJvAp5QXCqRfwf+X8dvWM9-Pw@mail.gmail.com>
[not found] ` <201202100053.46289.lindner_marek@yahoo.de>
[not found] ` <CAFevQmP9EDXbAVeO+9cvfhJ2i8rWeNo3PW8uTcUZkpazohsj3A@mail.gmail.com>
[not found] ` <201202111808.54341.lindner_marek@yahoo.de>
2012-02-26 17:49 ` [B.A.T.M.A.N.] Fwd: /lib/batman-adv/config.sh Filippo Sallemi
2012-02-26 17:50 ` [B.A.T.M.A.N.] /lib/batman-adv/config.sh Filippo Sallemi
2012-02-27 8:11 ` [B.A.T.M.A.N.] Fwd: /lib/batman-adv/config.sh Marek Lindner
2012-02-27 12:42 ` Filippo Sallemi
2012-02-28 5:44 ` Marek Lindner
2012-02-28 8:06 ` Filippo Sallemi
2012-02-28 8:21 ` Marek Lindner
2012-02-28 10:36 ` Filippo Sallemi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox