public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] openwrt lib/batman-adv/config.sh
       [not found] ` <CAFevQmMWGcJhzKiZzDKOh_pMAq1CyMJrPh=FMpYAQh-wXZwH=g@mail.gmail.com>
@ 2011-08-16 10:58   ` Filippo Sallemi
  2011-08-16 15:30     ` Marek Lindner
  0 siblings, 1 reply; 7+ messages in thread
From: Filippo Sallemi @ 2011-08-16 10:58 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 588 bytes --]

Hi all,

i thought it was a good idea to move the functions "start_mesh" and
"stop_mesh" from /etc/init.d/batman-adv script to a new file in
openwrt style "/lib/batman-adv/config.sh".
With this improvment it possible to recycle this two function to
operate with an hotplug script so when network restart, all batman
interface will be reconfigured automatically and I just work to do
this.
In this mail you can find batman-adv initscript updated to work in
this way and the batman-adv library file that must be located in
/lib/batman-adv/.
Any comment are apprecciated

--
Filippo Sallemi

[-- Attachment #2: config.sh --]
[-- Type: application/x-sh, Size: 2742 bytes --]

[-- Attachment #3: batman-adv --]
[-- Type: application/octet-stream, Size: 402 bytes --]

#!/bin/sh /etc/rc.common

START=90

. /lib/batman-adv/config.sh

# can also be used with "batman-adv start bat0"
start() {
	config_load batman-adv

	if [ -n "${1}" ]; then
		start_mesh ${1}
	else
		config_foreach start_mesh mesh
	fi
}

# can also be used with "batman-adv stop bat0"
stop() {
	config_load batman-adv

	if [ -n "${1}" ]; then
		stop_mesh ${1}
	else
		config_foreach stop_mesh mesh
	fi
}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [B.A.T.M.A.N.] openwrt lib/batman-adv/config.sh
  2011-08-16 10:58   ` [B.A.T.M.A.N.] openwrt lib/batman-adv/config.sh Filippo Sallemi
@ 2011-08-16 15:30     ` Marek Lindner
  2011-08-17  4:54       ` Filippo Sallemi
  0 siblings, 1 reply; 7+ messages in thread
From: Marek Lindner @ 2011-08-16 15:30 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking


Hi,

> In this mail you can find batman-adv initscript updated to work in
> this way and the batman-adv library file that must be located in
> /lib/batman-adv/.

I liked the idea of having hotplug hooks to restart the batman-adv 
configuration automatically. 
Generally, the scripts look good to me. You also changed its "coding style", 
e.g. $var -> ${var}. This does not look very OpenWRT-ish, therefore I would 
prefer keeping the current style. Any objections ?

Regards,
Marek

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [B.A.T.M.A.N.] openwrt lib/batman-adv/config.sh
  2011-08-16 15:30     ` Marek Lindner
@ 2011-08-17  4:54       ` Filippo Sallemi
  2011-08-21 23:46         ` Marek Lindner
  0 siblings, 1 reply; 7+ messages in thread
From: Filippo Sallemi @ 2011-08-17  4:54 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

No. no prblem from me

2011/8/16 Marek Lindner <lindner_marek@yahoo.de>:
>
> Hi,
>
>> In this mail you can find batman-adv initscript updated to work in
>> this way and the batman-adv library file that must be located in
>> /lib/batman-adv/.
>
> I liked the idea of having hotplug hooks to restart the batman-adv
> configuration automatically.
> Generally, the scripts look good to me. You also changed its "coding style",
> e.g. $var -> ${var}. This does not look very OpenWRT-ish, therefore I would
> prefer keeping the current style. Any objections ?
>
> Regards,
> Marek
>



-- 
Filippo Sallemi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [B.A.T.M.A.N.] openwrt lib/batman-adv/config.sh
  2011-08-17  4:54       ` Filippo Sallemi
@ 2011-08-21 23:46         ` Marek Lindner
  2011-08-24 11:50           ` Filippo Sallemi
  0 siblings, 1 reply; 7+ messages in thread
From: Marek Lindner @ 2011-08-21 23:46 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Wednesday, August 17, 2011 06:54:20 Filippo Sallemi wrote:
> No. no prblem from me

Ok, I just comitted the new package. Let me know when you have the hotplug 
stuff ready to be included as well.

Regards,
Marek

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [B.A.T.M.A.N.] openwrt lib/batman-adv/config.sh
  2011-08-21 23:46         ` Marek Lindner
@ 2011-08-24 11:50           ` Filippo Sallemi
  2011-09-12 17:43             ` Filippo Sallemi
  0 siblings, 1 reply; 7+ messages in thread
From: Filippo Sallemi @ 2011-08-24 11:50 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

Ok. I'm just working on it

2011/8/22 Marek Lindner <lindner_marek@yahoo.de>:
> On Wednesday, August 17, 2011 06:54:20 Filippo Sallemi wrote:
>> No. no prblem from me
>
> Ok, I just comitted the new package. Let me know when you have the hotplug
> stuff ready to be included as well.
>
> Regards,
> Marek
>



-- 
Filippo Sallemi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [B.A.T.M.A.N.] openwrt lib/batman-adv/config.sh
  2011-08-24 11:50           ` Filippo Sallemi
@ 2011-09-12 17:43             ` Filippo Sallemi
  2011-10-30 21:36               ` Marek Lindner
  0 siblings, 1 reply; 7+ messages in thread
From: Filippo Sallemi @ 2011-09-12 17:43 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 779 bytes --]

Hi all,
I've writed a hotplug.d script that readd interfaces that are present
in every bat definition of batman-adv uci file when network restart or
 an interface come up.
This script must be placed in /etc/hotplug.d/net/

P.S. for Marek you don't need to split /etc/init.d/batman-adv function
in a separate file such the previous emails.

Rgds.

Filippo

2011/8/24 Filippo Sallemi <tonyputi@gmail.com>:
> Ok. I'm just working on it
>
> 2011/8/22 Marek Lindner <lindner_marek@yahoo.de>:
>> On Wednesday, August 17, 2011 06:54:20 Filippo Sallemi wrote:
>>> No. no prblem from me
>>
>> Ok, I just comitted the new package. Let me know when you have the hotplug
>> stuff ready to be included as well.
>>
>> Regards,
>> Marek
>>
>
>
>
> --
> Filippo Sallemi
>



-- 
Filippo Sallemi

[-- Attachment #2: 99-batman-adv --]
[-- Type: application/octet-stream, Size: 638 bytes --]

#!/bin/sh
# Copyright (C) 2011 OpenWrt.org

setup_iface(){
	local mesh=$1
	local device=$2
	local interfaces
	
	config_get interfaces $mesh interfaces
	
	for interface in $interfaces; do
		[ ! -f "/sys/class/net/$interface/batman_adv/mesh_iface" ] && {
			interface=$(uci -P /var/state get network.$interface.ifname 2>&-)
			[ ! -f "/sys/class/net/$interface/batman_adv/mesh_iface" ] && continue
		}
		
		[ "$device" ==  "$interface" ] && {
			echo $mesh > /sys/class/net/$interface/batman_adv/mesh_iface
		}
	done
}

case "$ACTION" in
    add)
		config_clear
		config_load batman-adv
		config_foreach setup_iface mesh $INTERFACE
	;;
esac

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [B.A.T.M.A.N.] openwrt lib/batman-adv/config.sh
  2011-09-12 17:43             ` Filippo Sallemi
@ 2011-10-30 21:36               ` Marek Lindner
  0 siblings, 0 replies; 7+ messages in thread
From: Marek Lindner @ 2011-10-30 21:36 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking


Filippo,

> I've writed a hotplug.d script that readd interfaces that are present
> in every bat definition of batman-adv uci file when network restart or
>  an interface come up.
> This script must be placed in /etc/hotplug.d/net/
> 
> P.S. for Marek you don't need to split /etc/init.d/batman-adv function
> in a separate file such the previous emails.

I am little bit late with your script but finally got around looking at it. 
Why don't we use the functions from /lib/batman-adv/config.sh as we previously 
discussed ? Any unexpected side effects ?

Regards,
Marek

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-10-30 21:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.52.1312816695.1125.b.a.t.m.a.n@lists.open-mesh.org>
     [not found] ` <CAFevQmMWGcJhzKiZzDKOh_pMAq1CyMJrPh=FMpYAQh-wXZwH=g@mail.gmail.com>
2011-08-16 10:58   ` [B.A.T.M.A.N.] openwrt lib/batman-adv/config.sh Filippo Sallemi
2011-08-16 15:30     ` Marek Lindner
2011-08-17  4:54       ` Filippo Sallemi
2011-08-21 23:46         ` Marek Lindner
2011-08-24 11:50           ` Filippo Sallemi
2011-09-12 17:43             ` Filippo Sallemi
2011-10-30 21:36               ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox