288daf5a47
With batman-adv 2020.4 and the according backports to batman-adv v2019.2 several more bugs were found and fixed regarding the batman-adv multicast optimizations feature. Also a "wakeup-call" feature was added to the Linux bridge IGMP/MLD snooping code in Gluon to work around issues with Android devices. With batman-adv now at v2019.2, multicast-to-multi-unicasts conversion is supported, too. Which means that even if there are a few outdated nodes these and all other recipients will be served multicast packets via unicast, too, as long as the sum of receiving nodes does not exceed the multicast fanout setting (default: 16). If is exceeded, then batman-adv will revert back to broadcast flooding automatically. Long story short, with all these extra measures in place, let's reenable the batman-adv multicast optimizations to reduce the layer 2 overhead and in preparation for multicast applications in the future. The default is enabled for this feature anyway, so removing the "batctl multicast_mode 0" overwrite is sufficient. Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
91 lines
1.7 KiB
Bash
Executable File
91 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
. /lib/functions.sh
|
|
. ../netifd-proto.sh
|
|
init_proto "$@"
|
|
|
|
proto_gluon_bat0_init_config() {
|
|
no_device=1
|
|
available=1
|
|
renew_handler=1
|
|
|
|
proto_config_add_string 'gw_mode'
|
|
}
|
|
|
|
lookup_site() {
|
|
local path="$1" default="$2"
|
|
lua -e "print(require('gluon.site').$path('$default'))"
|
|
}
|
|
|
|
lookup_uci() {
|
|
local path="$1" default="$2"
|
|
uci -q get "$path" || echo "$default"
|
|
}
|
|
|
|
proto_gluon_bat0_renew() {
|
|
local config="$1"
|
|
|
|
lock /var/lock/gluon_bat0.lock
|
|
|
|
ubus call network.interface dump | jsonfilter \
|
|
-e "@.interface[@.proto='gluon_mesh' && @.up=true].device" \
|
|
| xargs -r -n 1 batctl interface add
|
|
|
|
lock -u /var/lock/gluon_bat0.lock
|
|
}
|
|
|
|
proto_gluon_bat0_setup() {
|
|
local config="$1"
|
|
|
|
local routing_algo=$(lookup_site 'mesh.batman_adv.routing_algo' 'BATMAN_IV')
|
|
|
|
local gw_mode
|
|
json_get_vars gw_mode
|
|
|
|
batctl routing_algo "$routing_algo"
|
|
batctl interface create
|
|
|
|
batctl orig_interval 5000
|
|
batctl hop_penalty "$(lookup_uci 'gluon.mesh_batman_adv.hop_penalty' 15)"
|
|
|
|
case "$gw_mode" in
|
|
server)
|
|
batctl gw_mode "server"
|
|
;;
|
|
client)
|
|
local gw_sel_class="$(lookup_site 'mesh.batman_adv.gw_sel_class')"
|
|
if [ -n "$gw_sel_class" ]; then
|
|
batctl gw_mode "client" "$gw_sel_class"
|
|
else
|
|
batctl gw_mode "client"
|
|
fi
|
|
;;
|
|
*)
|
|
batctl gw_mode "off"
|
|
;;
|
|
esac
|
|
|
|
|
|
local primary0_mac="$(lua -e 'print(require("gluon.util").generate_mac(3))')"
|
|
|
|
ip link add primary0 type dummy
|
|
echo 1 > /proc/sys/net/ipv6/conf/primary0/disable_ipv6
|
|
ip link set primary0 address "$primary0_mac" mtu 1532 up
|
|
|
|
batctl interface add primary0
|
|
|
|
proto_init_update primary0 1
|
|
proto_send_update "$config"
|
|
|
|
proto_gluon_bat0_renew "$1"
|
|
}
|
|
|
|
proto_gluon_bat0_teardown() {
|
|
local config="$1"
|
|
|
|
batctl interface destroy
|
|
ip link del primary0
|
|
}
|
|
|
|
add_protocol gluon_bat0
|