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 aggregated_ogms bonding fragmentation gw_bandwidth gw_mode gw_sel_class log_level orig_interval vis_mode
19 [ $? -ne 1 ] && return
21 config_get interfaces "$meshif" interfaces
22 config_get aggregated_ogms "$meshif" aggregated_ogms
23 config_get bonding "$meshif" bonding
24 config_get fragmentation "$meshif" fragmentation
25 config_get gw_bandwidth "$meshif" gw_bandwidth
26 config_get gw_mode "$meshif" gw_mode
27 config_get gw_sel_class "$meshif" gw_sel_class
28 config_get log_level "$meshif" log_level
29 config_get orig_interval "$meshif" orig_interval
30 config_get vis_mode "$meshif" vis_mode
32 if [ "$interfaces" = "" ]; then
33 echo Error, you must specify at least a network interface
37 for interface in $interfaces
39 [ ! -f "/sys/class/net/$interface/batman_adv/mesh_iface" ] && echo "Can't add interface $interface - ignoring" && continue
40 echo $meshif > /sys/class/net/$interface/batman_adv/mesh_iface
43 if [ $orig_interval ]; then
44 echo $orig_interval > /sys/class/net/$meshif/mesh/orig_interval
47 if [ $log_level ]; then
48 echo $log_level > /sys/class/net/$meshif/mesh/log_level 2>&-
51 if [ $aggregated_ogms ]; then
52 echo $aggregated_ogms > /sys/class/net/$meshif/mesh/aggregated_ogms
56 echo $bonding > /sys/class/net/$meshif/mesh/bonding
59 if [ $fragmentation ]; then
60 echo $fragmentation > /sys/class/net/$meshif/mesh/fragmentation
63 if [ $gw_bandwidth ]; then
64 echo $gw_bandwidth > /sys/class/net/$meshif/mesh/gw_bandwidth
68 echo $gw_mode > /sys/class/net/$meshif/mesh/gw_mode
71 if [ $gw_sel_class ]; then
72 echo $gw_sel_class > /sys/class/net/$meshif/mesh/gw_sel_class
75 if [ $vis_mode ]; then
76 echo $vis_mode > /sys/class/net/$meshif/mesh/vis_mode
84 [ $? -ne 1 ] && return
86 for iface in $(ls /sys/class/net/*)
88 [ ! -f "$iface/batman_adv/mesh_iface" ] && continue
89 [ "$(head -1 $iface/batman_adv/mesh_iface)" != "status: $meshif" ] && continue
91 echo "none" > $iface/batman_adv/mesh_iface
95 # can also be used with "batman-adv start bat0"
97 config_load batman-adv
102 config_foreach start_mesh mesh
106 # can also be used with "batman-adv stop bat0"
108 config_load batman-adv
113 config_foreach stop_mesh mesh