Merge remote-tracking branch 'nodogsplash/master'
[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/*-crypto* /etc/modules.d/*-lib-crc* /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 network_coding 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 network_coding "$mesh" network_coding
28 config_get log_level "$mesh" log_level
29 config_get orig_interval "$mesh" orig_interval
30 config_get vis_mode "$mesh" vis_mode
31
32 [ ! -f "/sys/class/net/$mesh/mesh/orig_interval" ] && echo "batman-adv mesh $mesh does not exist - check your interface configuration" && return 1
33
34 [ -n "$aggregate_ogms" ] && echo $aggregate_ogms > /sys/class/net/$mesh/mesh/aggregate_ogms
35 [ -n "$ap_isolation" ] && echo $ap_isolation > /sys/class/net/$mesh/mesh/ap_isolation
36 [ -n "$bonding" ] && echo $bonding > /sys/class/net/$mesh/mesh/bonding
37 [ -n "$bridge_loop_avoidance" ] && echo $bridge_loop_avoidance > /sys/class/net/$mesh/mesh/bridge_loop_avoidance 2>&-
38 [ -n "$distributed_arp_table" ] && echo $distributed_arp_table > /sys/class/net/$mesh/mesh/distributed_arp_table 2>&-
39 [ -n "$fragmentation" ] && echo $fragmentation > /sys/class/net/$mesh/mesh/fragmentation
40 [ -n "$gw_bandwidth" ] && echo $gw_bandwidth > /sys/class/net/$mesh/mesh/gw_bandwidth
41 [ -n "$gw_mode" ] && echo $gw_mode > /sys/class/net/$mesh/mesh/gw_mode
42 [ -n "$gw_sel_class" ] && echo $gw_sel_class > /sys/class/net/$mesh/mesh/gw_sel_class
43 [ -n "$hop_penalty" ] && echo $hop_penalty > /sys/class/net/$mesh/mesh/hop_penalty
44 [ -n "$network_coding" ] && echo $network_coding > /sys/class/net/$mesh/mesh/network_coding 2>&-
45 [ -n "$log_level" ] && echo $log_level > /sys/class/net/$mesh/mesh/log_level 2>&-
46 [ -n "$orig_interval" ] && echo $orig_interval > /sys/class/net/$mesh/mesh/orig_interval
47 [ -n "$vis_mode" ] && echo $vis_mode > /sys/class/net/$mesh/mesh/vis_mode
48 }