proto_batadv_init_config() {
proto_config_add_string "mesh"
+ proto_config_add_string "routing_algo"
}
proto_batadv_setup() {
local config="$1"
local iface="$2"
- local mesh
- json_get_vars mesh
+ local mesh routing_algo
+ json_get_vars mesh routing_algo
+
+ [ -n "$routing_algo" ] || routing_algo="BATMAN_IV"
+ batctl routing_algo "$routing_algo"
- echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface"
+ batctl -m "$mesh" interface add "$iface"
proto_init_update "$iface" 1
proto_send_update "$config"
}
local config="$1"
local iface="$2"
- echo "none" > "/sys/class/net/$iface/batman_adv/mesh_iface" || true
+ local mesh
+ json_get_vars mesh
+
+ batctl -m "$mesh" interface del "$iface" || true
}
add_protocol batadv