1 #!/bin/sh /etc/rc.common
6 if [ ! -d "/sys/module/batman_adv" ]; then
7 echo "batman-adv module directory not found - was the kernel module loaded ?" >&2
16 local interfaces orig_interval log_level aggregated_ogms bonding vis_mode
19 [ $?
-ne 1 ] && return
21 config_get interfaces
"$meshif" interfaces
22 config_get orig_interval
"$meshif" orig_interval
23 config_get log_level
"$meshif" log_level
24 config_get aggregated_ogms
"$meshif" aggregated_ogms
25 config_get bonding
"$meshif" bonding
26 config_get vis_mode
"$meshif" vis_mode
28 if [ "$interfaces" = "" ]; then
29 echo Error
, you must specify
at least a network interface
33 for interface
in $interfaces
35 [ ! -f "/sys/class/net/$interface/batman_adv/mesh_iface" ] && echo "Can't add interface $interface - ignoring" && continue
36 echo $meshif > /sys
/class
/net
/$interface/batman_adv
/mesh_iface
39 if [ $orig_interval ]; then
40 echo $orig_interval > /sys
/class
/net
/$meshif/mesh
/orig_interval
43 if [ $log_level ]; then
44 echo $log_level > /sys
/class
/net
/$meshif/mesh
/log_level
2>&-
47 if [ $aggregated_ogms ]; then
48 echo $aggregated_ogms > /sys
/class
/net
/$meshif/mesh
/aggregated_ogms
52 echo $bonding > /sys
/class
/net
/$meshif/mesh
/bonding
55 if [ $vis_mode ]; then
56 echo $vis_mode > /sys
/class
/net
/$meshif/mesh
/vis_mode
64 [ $?
-ne 1 ] && return
66 for iface
in $
(ls /sys
/class
/net
/*)
68 [ ! -f "$iface/batman_adv/mesh_iface" ] && continue
69 [ "$(head -1 $iface/batman_adv/mesh_iface)" != "status: $meshif" ] && continue
71 echo "none" > $iface/batman_adv
/mesh_iface
75 # can also be used with "batman-adv start bat0"
77 config_load batman-adv
82 config_foreach start_mesh mesh
86 # can also be used with "batman-adv stop bat0"
88 config_load batman-adv
93 config_foreach stop_mesh mesh