move batman-adv files to subdirectory
[feed/routing.git] / batman-adv / files / lib / batman-adv / config.sh
1 #!/bin/sh
2
3 bat_load_module()
4 {
5 [ -d "/sys/module/batman_adv/" ] && return
6
7 . /lib/functions.sh
8 load_modules /etc/modules.d/*-crc16 /etc/modules.d/*-batman-adv*
9 }
10
11 bat_config()
12 {
13 local mesh="$1"
14 local aggregated_ogms ap_isolation bonding bridge_loop_avoidance distributed_arp_table fragmentation
15 local gw_bandwidth gw_mode gw_sel_class hop_penalty log_level orig_interval vis_mode
16
17 config_get aggregated_ogms "$mesh" aggregated_ogms
18 config_get ap_isolation "$mesh" ap_isolation
19 config_get bonding "$mesh" bonding
20 config_get bridge_loop_avoidance "$mesh" bridge_loop_avoidance
21 config_get distributed_arp_table "$mesh" distributed_arp_table
22 config_get fragmentation "$mesh" fragmentation
23 config_get gw_bandwidth "$mesh" gw_bandwidth
24 config_get gw_mode "$mesh" gw_mode
25 config_get gw_sel_class "$mesh" gw_sel_class
26 config_get hop_penalty "$mesh" hop_penalty
27 config_get log_level "$mesh" log_level
28 config_get orig_interval "$mesh" orig_interval
29 config_get vis_mode "$mesh" vis_mode
30
31 [ ! -f "/sys/class/net/$mesh/mesh/orig_interval" ] && echo "batman-adv mesh $mesh does not exist - check your interface configuration" && return 1
32
33 [ -n "$aggregate_ogms" ] && echo $aggregate_ogms > /sys/class/net/$mesh/mesh/aggregate_ogms
34 [ -n "$ap_isolation" ] && echo $ap_isolation > /sys/class/net/$mesh/mesh/ap_isolation
35 [ -n "$bonding" ] && echo $bonding > /sys/class/net/$mesh/mesh/bonding
36 [ -n "$bridge_loop_avoidance" ] && echo $bridge_loop_avoidance > /sys/class/net/$mesh/mesh/bridge_loop_avoidance
37 [ -n "$distributed_arp_table" ] && echo $distributed_arp_table > /sys/class/net/$mesh/mesh/distributed_arp_table
38 [ -n "$fragmentation" ] && echo $fragmentation > /sys/class/net/$mesh/mesh/fragmentation
39 [ -n "$gw_bandwidth" ] && echo $gw_bandwidth > /sys/class/net/$mesh/mesh/gw_bandwidth
40 [ -n "$gw_mode" ] && echo $gw_mode > /sys/class/net/$mesh/mesh/gw_mode
41 [ -n "$gw_sel_class" ] && echo $gw_sel_class > /sys/class/net/$mesh/mesh/gw_sel_class
42 [ -n "$hop_penalty" ] && echo $hop_penalty > /sys/class/net/$mesh/mesh/hop_penalty
43 [ -n "$log_level" ] && echo $log_level > /sys/class/net/$mesh/mesh/log_level 2>&-
44 [ -n "$orig_interval" ] && echo $orig_interval > /sys/class/net/$mesh/mesh/orig_interval
45 [ -n "$vis_mode" ] && echo $vis_mode > /sys/class/net/$mesh/mesh/vis_mode
46 }