3d6b8849c1723bcf31d10c74ddbbda5e92288e46
[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 isolation_mark hop_penalty multicast_mode network_coding log_level
16 local orig_interval
17
18 config_get aggregated_ogms "$mesh" aggregated_ogms
19 config_get ap_isolation "$mesh" ap_isolation
20 config_get bonding "$mesh" bonding
21 config_get bridge_loop_avoidance "$mesh" bridge_loop_avoidance
22 config_get distributed_arp_table "$mesh" distributed_arp_table
23 config_get fragmentation "$mesh" fragmentation
24 config_get gw_bandwidth "$mesh" gw_bandwidth
25 config_get gw_mode "$mesh" gw_mode
26 config_get gw_sel_class "$mesh" gw_sel_class
27 config_get hop_penalty "$mesh" hop_penalty
28 config_get isolation_mark "$mesh" isolation_mark
29 config_get multicast_mode "$mesh" multicast_mode
30 config_get network_coding "$mesh" network_coding
31 config_get log_level "$mesh" log_level
32 config_get orig_interval "$mesh" orig_interval
33
34 [ ! -f "/sys/class/net/$mesh/mesh/orig_interval" ] && echo "batman-adv mesh $mesh does not exist - check your interface configuration" && return 1
35
36 [ -n "$aggregated_ogms" ] && batctl -m "$mesh" aggregation "$aggregated_ogms"
37 [ -n "$ap_isolation" ] && batctl -m "$mesh" ap_isolation "$ap_isolation"
38 [ -n "$bonding" ] && batctl -m "$mesh" bonding "$bonding"
39 [ -n "$bridge_loop_avoidance" ] && batctl -m "$mesh" bridge_loop_avoidance "$bridge_loop_avoidance" 2>&-
40 [ -n "$distributed_arp_table" ] && batctl -m "$mesh" distributed_arp_table "$distributed_arp_table" 2>&-
41 [ -n "$fragmentation" ] && batctl -m "$mesh" fragmentation "$fragmentation"
42
43 [ -n "$gw_bandwidth" ] && echo $gw_bandwidth > /sys/class/net/$mesh/mesh/gw_bandwidth
44 [ -n "$gw_mode" ] && echo $gw_mode > /sys/class/net/$mesh/mesh/gw_mode
45 [ -n "$gw_sel_class" ] && echo $gw_sel_class > /sys/class/net/$mesh/mesh/gw_sel_class
46 [ -n "$hop_penalty" ] && echo $hop_penalty > /sys/class/net/$mesh/mesh/hop_penalty
47
48 [ -n "$isolation_mark" ] && batctl -m "$mesh" isolation_mark "$isolation_mark"
49 [ -n "$multicast_mode" ] && batctl -m "$mesh" multicast_mode "$multicast_mode" 2>&-
50 [ -n "$network_coding" ] && batctl -m "$mesh" network_coding "$network_coding" 2>&-
51 [ -n "$log_level" ] && batctl -m "$mesh" loglevel "$log_level" 2>&-
52 [ -n "$orig_interval" ] && batctl -m "$mesh" orig_interval "$orig_interval"
53 }