diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml index af75f398..3cecde33 100644 --- a/group_vars/all/vars.yml +++ b/group_vars/all/vars.yml @@ -6,3 +6,4 @@ site_domain: 'bremen.freifunk.net' site_vpn_prefix: 'vpn' icvpn_as: 65196 fastd_peers_limit: 200 +batman_routing_algo: 'BATMAN_V' diff --git a/roles/batman-adv-interface/defaults/main.yml b/roles/batman-adv-interface/defaults/main.yml index ce1b3d65..f79ee27a 100644 --- a/roles/batman-adv-interface/defaults/main.yml +++ b/roles/batman-adv-interface/defaults/main.yml @@ -3,3 +3,4 @@ batman_interface: bat-{{ site_code }} batman_dummy_interface: 'bat-{{ site_code }}-dummy' batman_hop_penalty: 96 batman_gateway: false +batman_routing_algo: 'BATMAN_IV' diff --git a/roles/batman-adv-interface/files/if-pre-up b/roles/batman-adv-interface/files/if-pre-up index 396a89a4..9715e38b 100755 --- a/roles/batman-adv-interface/files/if-pre-up +++ b/roles/batman-adv-interface/files/if-pre-up @@ -21,6 +21,12 @@ case "$IF_BATADV_PORTS" in ;; esac +# taken from openWRT: +# https://git.openwrt.org/?p=feed/routing.git;a=blob;f=batman-adv/files/lib/netifd/proto/batadv.sh;h=edc14f4cbd5485ede408e897fada8eae6f8f09d3;hb=ecb7132f014275a9fa0509e790257f0a66802a1d#l72 +# maybe following is possible after create: +# batctl meshif "$IFACE" routing_algo "${IF_BATADV_ROUTING_ALGO:-BATMAN_IV}" +batctl routing_algo "${IF_BATADV_ROUTING_ALGO:-BATMAN_IV}" + if ! batctl meshif "$IFACE" interface >/dev/null 2>&1; then batctl meshif "$IFACE" interface create fi diff --git a/roles/batman-adv-interface/templates/interfaces b/roles/batman-adv-interface/templates/interfaces index 6d8a5dd5..1231444d 100644 --- a/roles/batman-adv-interface/templates/interfaces +++ b/roles/batman-adv-interface/templates/interfaces @@ -4,12 +4,18 @@ auto {{ batman_dummy_interface }} iface {{ batman_dummy_interface }} inet manual pre-up ip link add name $IFACE type dummy up ip link set $IFACE up +{% if batman_routing_algo == 'BATMAN_V' %} + # let batman handle the multicast + # https://gluon.readthedocs.io/en/latest/package/gluon-mesh-batman-adv.html + post-up bash -c 'echo 2 > /sys/class/net/{{ batman_dummy_interface }}/brport/multicast_router' +{% endif %} down ip link set $IFACE down post-down ip link del $IFACE auto {{ batman_interface }} iface {{ batman_interface }} inet manual batadv-ports {{ batman_dummy_interface }} + batadv-routing-algo {{ batman_routing_algo }} {% if ansible_default_ipv6.macaddress is defined %} batadv-hw {{ ansible_default_ipv6.macaddress | derive_mac_addr(2) }} {% else %} diff --git a/roles/main-bridge/templates/interfaces b/roles/main-bridge/templates/interfaces index 51efe5d4..2e2ff2c3 100644 --- a/roles/main-bridge/templates/interfaces +++ b/roles/main-bridge/templates/interfaces @@ -25,7 +25,12 @@ iface br-{{ site_code }} inet static # tune ARP and IPv6 neighbor soolicitation post-up sysctl -p /etc/sysctl.d/main-bridge-ip-neigh-tuning.conf # increase multicast table - post-up bash -c 'echo 2048 > /sys/class/net/br-ffhb/bridge/hash_max' +{% if batman_routing_algo is defined and batman_routing_algo == 'BATMAN_V' %} + # let batman handle the multicast + # https://gluon.readthedocs.io/en/latest/package/gluon-mesh-batman-adv.html + post-up bash -c 'echo 2 > /sys/class/net/br-{{ site_code }}/brport/multicast_router' +{% endif %} + post-up bash -c 'echo 2048 > /sys/class/net/br-{{ site_code }}/bridge/hash_max' iface br-{{ site_code }} inet6 static address {{ batman_ipv6_local.address }}