Merge pull request #150 from booo/olsrd2_hotplug_fix
[feed/routing.git] / batman-adv / files / lib / netifd / proto / batadv.sh
1 #!/bin/sh
2
3 . /lib/functions.sh
4 . ../netifd-proto.sh
5 init_proto "$@"
6
7 proto_batadv_init_config() {
8 proto_config_add_string "mesh"
9 proto_config_add_string "routing_algo"
10 }
11
12 proto_batadv_setup() {
13 local config="$1"
14 local iface="$2"
15
16 local mesh routing_algo
17 json_get_vars mesh routing_algo
18
19 [ -n "$routing_algo" ] || routing_algo="BATMAN_IV"
20 echo "$routing_algo" > "/sys/module/batman_adv/parameters/routing_algo"
21
22 echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface"
23 proto_init_update "$iface" 1
24 proto_send_update "$config"
25 }
26
27 proto_batadv_teardown() {
28 local config="$1"
29 local iface="$2"
30
31 echo "none" > "/sys/class/net/$iface/batman_adv/mesh_iface" || true
32 }
33
34 add_protocol batadv