2 # Copyright (C) 2011 OpenWrt.org
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 ifname
=$
(uci
-P /var
/state get network.
$interface.ifname
2>&-)
40 [ ! -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] && {
42 [ ! -f "/sys/class/net/$ifname/batman_adv/mesh_iface" ] && echo "Can't add interface $ifname - ignoring" && continue
45 echo $meshif > /sys
/class
/net
/$ifname/batman_adv
/mesh_iface
48 if [ $orig_interval ]; then
49 echo $orig_interval > /sys
/class
/net
/$meshif/mesh
/orig_interval
52 if [ $log_level ]; then
53 echo $log_level > /sys
/class
/net
/$meshif/mesh
/log_level
2>&-
56 if [ $aggregated_ogms ]; then
57 echo $aggregated_ogms > /sys
/class
/net
/$meshif/mesh
/aggregated_ogms
61 echo $bonding > /sys
/class
/net
/$meshif/mesh
/bonding
64 if [ $fragmentation ]; then
65 echo $fragmentation > /sys
/class
/net
/$meshif/mesh
/fragmentation
68 if [ $gw_bandwidth ]; then
69 echo $gw_bandwidth > /sys
/class
/net
/$meshif/mesh
/gw_bandwidth
73 echo $gw_mode > /sys
/class
/net
/$meshif/mesh
/gw_mode
76 if [ $gw_sel_class ]; then
77 echo $gw_sel_class > /sys
/class
/net
/$meshif/mesh
/gw_sel_class
80 if [ $vis_mode ]; then
81 echo $vis_mode > /sys
/class
/net
/$meshif/mesh
/vis_mode
89 [ $?
-ne 1 ] && return
91 for iface
in $
(ls /sys
/class
/net
/*)
93 [ ! -f "$iface/batman_adv/mesh_iface" ] && continue
94 [ "$(head -1 $iface/batman_adv/mesh_iface)" != "$meshif" ] && continue
96 echo "none" > $iface/batman_adv
/mesh_iface