2233091452dbfad801bb1e93ae90cd03919fac87
[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 batctl routing_algo "$routing_algo"
21
22 batctl -m "$mesh" interface add "$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 local mesh
32 json_get_vars mesh
33
34 batctl -m "$mesh" interface del "$iface" || true
35 }
36
37 add_protocol batadv