[From nobody Thu Jun 25 05:55:03 2020
Received: from mail.codigosur.net ([109.69.10.39])
 by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux))
 id 1gy58M-0000Gj-Ba
 for openwrt-devel@lists.openwrt.org; Mon, 25 Feb 2019 01:32:45 +0000
Received: from authenticated-user (mail.codigosur.net [109.69.10.39])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by mail.codigosur.net (Postfix) with ESMTPSA id E532A8E0DAB;
 Mon, 25 Feb 2019 01:25:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=altermundi.net;
 s=mail; t=1551057911;
 bh=KjwlSpiTx/oJc8sRVrajJ1jTVaN0GX42XT2kKop1L2Y=;
 h=Date:In-Reply-To:References:Subject:To:CC:From:From;
 b=F8TmeNnGMKWLNGfSbQ1rXMwqUxhmn+L0cUBn7Gn/sldkNrRhg/0WNW1nY6tmFabU5
 ZQ8GgUQFT0h+kinAFZujQSItP6ihKkAc06/39OzuAjbldWJXiSdpSPI2TNAlao7AnC
 HHX6Ym0FmyGtzyMMkZPm1heij2YkwzUTu4cNm+ZZ6a5ItNSnn8kA5EKZ4jyUStV+U2
 Qg4gU5vlvGwVwYGuGh/Wv7ObO+ODTI5XuEl1gTRLo7xhGGpo6eBtuMtLWRLp7JRyRG
 DXOKTEYa97sdLIy3i1JS3nG/bPHrnEnKiIMOBhNBTOON0mfBemAvwb1+rA3VaWXWtL
 770ZanxvDUjmQ==
Date: Sun, 24 Feb 2019 22:24:56 -0300
In-Reply-To: &lt;20190224165113.15726-1-sven@narfation.org&gt;
References: &lt;20190224165113.15726-1-sven@narfation.org&gt;
MIME-Version: 1.0
Content-Type: text/plain;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable
Autocrypt: addr=gui@altermundi.net; keydata=
 mQINBFKs2DIBEACe5dB3UZ96yebTghn0Ag45lIPMq2QUaxqyIf3DkYcY7FH8q5D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rPNIyD/EUwuy253/tn42I6jnsQZKulx/PjI91chM5GHXXX
 aj2/IYv6Lfo6oihuPLkAEQEAAYkCJQQYAQoADwIbDAUCWt9FBAUJChOgUgAKCRCCajQbwX8ayGlo
 D/90OtpAgQo/ul3/MiWyMoZskCsf4iv3U3Po1WXaApAUM7XTEaXoQU/4VFITEOBSwq7FsWwkgFGT
 7tz3t/lCHyvZCsoEELzDXNAo24ylXcO1TxryAZ1zpB1iipDqpDuYGeG8/BHIswJebLkEpQNgL4di
 1BZwsrk/jgUTjax+J6nAwWflyg+G/I+Xv+aYtYhP6pWMxcGzWKtQxGeKjX+JV9/xdt13ddE86gpy
 2HNU5Ed9s6wufCyxDSdy7Xy6CrWiQx0ft27kOFXupGe8dXX53np9pgF3Dwd+APacTfWgTlQeameg
 fX5cft3lqOl4Y5ctwrAO8VjxugP2xJQdOSOFvXG3pyUSBto36E+CpzXr9rfypdd4clb/6cUD0w+U
 mc8E+p1KfLIPrfcf3icbm/6Y4hSgqHDRRenEgk/6FvhmlesNix3yxVUyrcxp3JoOo1GKfk1ZfZsJ
 Krz7EvMoZUufYdLrXl1DehWRlj4xvNoL/1oTnZUuQgBCG7Zy9wEJtDOQSImJ61gzeMGm+YKi7zWo
 VqOV08CjcucsbX0WmaIB25bZHMdpQr6AtYgMDjvjPvrCVowtHciRJJjKPrcr6oRuPjZfG/CH4g0e
 Kj5lrbHF4kZPlMnd6pPhbfnMMGKHCDHwYwxCeqqdU/oNEq+q0rEHgySefxKLspJ8aNa3clNIRoCg
 PQ==
Subject: Re: [RFC openwrt-routing] batman-adv: Split batadv proto in meshif
 and hardif part
To: Sven Eckelmann &lt;sven@narfation.org&gt;,b.a.t.m.a.n@lists.open-mesh.org
CC: Matthias Schiffer &lt;mschiffer@universe-factory.net&gt;,
 openwrt-devel@lists.openwrt.org, Moritz Warning &lt;moritzwarning@web.de&gt;
From: Gui Iribarren &lt;gui@altermundi.net&gt;
Message-ID: &lt;037B7BA7-8D64-4B46-BDA8-C4D45AC9E61A@altermundi.net&gt;
X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 
X-CRM114-CacheID: sfid-20190224_173242_729059_5B6E8A0A 
X-CRM114-Status: GOOD (  15.54  )
X-Spam-Score: -0.2 (/)
X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary:
 Content analysis details:   (-0.2 points)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at http://www.dnswl.org/,
 no trust [109.69.10.39 listed in list.dnswl.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
 0.1 DKIM_SIGNED            Message has a DKIM or DK signature, not necessarily
 valid
 -0.1 DKIM_VALID_EF          Message has a valid DKIM or DK signature from
 envelope-from domain
 -0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from
 author's domain

agree on the current mess, and congratulations on working on it :)
have you considered, to simplify backwards compatibility, to keep proto &quot;b=
atadv&quot; as it currently is (hardif) and naming &quot;batadv_mesh&quot; the new proto?

Am 24=2E Februar 2019 13:51:13 GMT-03:00 schrieb Sven Eckelmann &lt;sven@narf=
ation=2Eorg&gt;:
&gt;batman-adv allows to configure three different objects:
&gt;
&gt;* batadv hardif
&gt;
&gt;  - network interface used by batadv meshif to transport the batman-adv
&gt;    packets
&gt;  - its master interface is set to the batadv meshif
&gt;
&gt;* batadv (meshif/softif)
&gt;
&gt;  - virtual interface that emulates a normal 802=2E3 interface on top
&gt;  - encapsulates traffic and forwards it via the batadv hardifs
&gt;
&gt;* batadv vlan
&gt;
&gt;  - potential VLAN ID on top of batadv meshif
&gt;  - allows filtering of traffic from specific VIDs
&gt;
&gt;While batadv vlan objects were already represented as an own proto
&gt;&quot;batadv_vlan&quot;, the batadv meshif could never be fully configured using
&gt;/etc/config/network=2E Instead, parts of its configuration were stored in
&gt;/etc/config/batman_adv and some in the interfaces with the &quot;batadv&quot;
&gt;proto=2E
&gt;
&gt;To increase the confusion, the &quot;batadv&quot; proto wasn't used to define the
&gt;batadv meshif but to identify batadv (slave) hardifs=2E The batman-adv
&gt;meshifs were also never created directly but only when a hardif was
&gt;configured=2E The actual modification of the configuration settings was
&gt;then
&gt;applied using a hotplug script hack=2E The batadv meshif network
&gt;interface
&gt;could therefore only be created when an hardif was available and not
&gt;manipulated with ifup/ifdown=2E Also `/etc/init=2Ed/network reload` didn'=
t
&gt;modify the batadv meshif interface configuration correctly=2E
&gt;
&gt;The &quot;batadv&quot; is now renamed to &quot;batadv_hardif&quot; and a new &quot;batadv&quot; proto
&gt;is
&gt;used to configure the main (meshif) network interface with all its
&gt;configuration=2E
&gt;
&gt;A simple network configuration with WiFi &amp; ethernet interfaces and
&gt;static
&gt;IP on top of bat0 would look like:
&gt;
&gt;  # batadv meshif bat0
&gt;  config interface 'bat0'
&gt;  	option proto 'batadv'
&gt;  	option routing_algo 'BATMAN_IV'
&gt;  	option aggregated_ogms 1
&gt;  	option ap_isolation 0
&gt;  	option bonding 0
&gt;  	option fragmentation 1
&gt;  	#option gw_bandwidth '10000/2000'
&gt;  	option gw_mode 'off'
&gt;  	#option gw_sel_class 20
&gt;  	option log_level 0
&gt;  	option orig_interval 1000
&gt;  	option bridge_loop_avoidance 1
&gt;  	option distributed_arp_table 1
&gt;  	option multicast_mode 1
&gt;  	option network_coding 0
&gt;  	option hop_penalty 30
&gt;  	option isolation_mark '0x00000000/0x00000000'
&gt;
&gt;# add *single* wifi-iface with network bat0_hardif_wlan as hardif to
&gt;bat0
&gt;  config interface 'bat0_hardif_wlan'
&gt;  	option mtu '1536'
&gt;  	option proto 'batadv_hardif'
&gt;  	option master 'bat0'
&gt;  	# option ifname is filled out by the wifi-iface
&gt;
&gt;  # add eth0 as hardif to bat0
&gt;  config interface 'bat0_hardif_eth0'
&gt;  	option proto 'batadv_hardif'
&gt;  	option master 'bat0'
&gt;  	option ifname 'eth0'
&gt;  	option mtu '1536'
&gt;
&gt;  # configure IP on bat0
&gt;  config interface 'bat0_lan'
&gt;  	option ifname 'bat0'
&gt;  	option proto 'static'
&gt;  	option ipaddr '192=2E168=2E1=2E1'
&gt;  	option netmask '255=2E255=2E255=2E0'
&gt;  	option ip6assign '60'
&gt;
&gt;Signed-off-by: Sven Eckelmann &lt;sven@narfation=2Eorg&gt;
&gt;---
&gt;Cc: Matthias Schiffer &lt;mschiffer@universe-factory=2Enet&gt;
&gt;Cc: openwrt-devel@lists=2Eopenwrt=2Eorg
&gt;Cc: Gui Iribarren &lt;gui@altermundi=2Enet&gt;
&gt;Cc: Moritz Warning &lt;moritzwarning@web=2Ede&gt;
&gt;
&gt;Changes depend on https://github=2Ecom/openwrt-routing/packages/pull/451
&gt;---
&gt; batman-adv/Makefile                           |   2 +-
&gt; batman-adv/files/etc/config/batman-adv        |  20 ----
&gt; =2E=2E=2E/files/etc/hotplug=2Ed/net/99-batman-adv     |  12 --
&gt; =2E=2E=2E/etc/uci-defaults/99-migrate-batadv_hardif |  97 ++++++++++++++=
+
&gt; batman-adv/files/lib/batman-adv/config=2Esh     |  69 -----------
&gt; batman-adv/files/lib/netifd/proto/batadv=2Esh   | 112 +++++++++++++++---
&gt; =2E=2E=2E/files/lib/netifd/proto/batadv_hardif=2Esh   |  40 +++++++
&gt; 7 files changed, 235 insertions(+), 117 deletions(-)
&gt; delete mode 100644 batman-adv/files/etc/config/batman-adv
&gt; delete mode 100644 batman-adv/files/etc/hotplug=2Ed/net/99-batman-adv
&gt;create mode 100755
&gt;batman-adv/files/etc/uci-defaults/99-migrate-batadv_hardif
&gt; delete mode 100644 batman-adv/files/lib/batman-adv/config=2Esh
&gt; create mode 100755 batman-adv/files/lib/netifd/proto/batadv_hardif=2Esh
&gt;
&gt;diff --git a/batman-adv/Makefile b/batman-adv/Makefile
&gt;index 82af6c7=2E=2Eb250888 100644
&gt;--- a/batman-adv/Makefile
&gt;+++ b/batman-adv/Makefile
&gt;@@ -10,7 +10,7 @@ include $(TOPDIR)/rules=2Emk
&gt; PKG_NAME:=3Dbatman-adv
&gt;=20
&gt; PKG_VERSION:=3D2019=2E0
&gt;-PKG_RELEASE:=3D2
&gt;+PKG_RELEASE:=3D3
&gt;PKG_HASH:=3D3e97d8a771cdbd7b2df42c52b88e071eaa58b5d28eb4e17a4b13b6698debb=
dc0
&gt;=20
&gt; PKG_SOURCE:=3D$(PKG_NAME)-$(PKG_VERSION)=2Etar=2Egz
&gt;diff --git a/batman-adv/files/etc/config/batman-adv
&gt;b/batman-adv/files/etc/config/batman-adv
&gt;deleted file mode 100644
&gt;index 21138cb=2E=2E0000000
&gt;--- a/batman-adv/files/etc/config/batman-adv
&gt;+++ /dev/null
&gt;@@ -1,20 +0,0 @@
&gt;-
&gt;-config 'mesh' 'bat0'
&gt;-	#option 'aggregated_ogms' 1
&gt;-	#option 'ap_isolation' 0
&gt;-	#option 'bonding' 0
&gt;-	#option 'fragmentation' 1
&gt;-	#option 'gw_bandwidth' '10000/2000'
&gt;-	#option 'gw_mode' 'off'
&gt;-	#option 'gw_sel_class' 20
&gt;-	#option 'log_level' 0
&gt;-	#option 'orig_interval' 1000
&gt;-	#option 'bridge_loop_avoidance' 1
&gt;-	#option 'distributed_arp_table' 1
&gt;-	#option 'multicast_mode' 1
&gt;-	#option 'network_coding' 0
&gt;-	#option 'hop_penalty' 30
&gt;-	#option 'isolation_mark' '0x00000000/0x00000000'
&gt;-
&gt;-# yet another batX instance
&gt;-# config 'mesh' 'bat5'
&gt;diff --git a/batman-adv/files/etc/hotplug=2Ed/net/99-batman-adv
&gt;b/batman-adv/files/etc/hotplug=2Ed/net/99-batman-adv
&gt;deleted file mode 100644
&gt;index f0c391f=2E=2E0000000
&gt;--- a/batman-adv/files/etc/hotplug=2Ed/net/99-batman-adv
&gt;+++ /dev/null
&gt;@@ -1,12 +0,0 @@
&gt;-#!/bin/sh
&gt;-
&gt;-=2E /lib/batman-adv/config=2Esh
&gt;-
&gt;-bat_load_module
&gt;-config_load batman-adv
&gt;-
&gt;-case &quot;$ACTION&quot; in
&gt;-	add)
&gt;-		[ -d /sys/class/net/$INTERFACE/mesh/ ] &amp;&amp; bat_config &quot;$INTERFACE&quot;
&gt;-		;;
&gt;-esac
&gt;diff --git a/batman-adv/files/etc/uci-defaults/99-migrate-batadv_hardif
&gt;b/batman-adv/files/etc/uci-defaults/99-migrate-batadv_hardif
&gt;new file mode 100755
&gt;index 0000000=2E=2E156a33f
&gt;--- /dev/null
&gt;+++ b/batman-adv/files/etc/uci-defaults/99-migrate-batadv_hardif
&gt;@@ -0,0 +1,97 @@
&gt;+#!/bin/sh
&gt;+
&gt;+# This UCI-Defaults script will split the batadv proto network
&gt;interfaces
&gt;+# in batadv_hardif and batadv proto=2E The configuration options from
&gt;+# /etc/config/batman-adv will be moved to the latter=2E
&gt;+
&gt;+=2E /lib/functions=2Esh
&gt;+
&gt;+proto_batadv_to_batadv_hardif() {
&gt;+    local section=3D&quot;$1&quot;
&gt;+    local proto
&gt;+    local mesh
&gt;+    local routing_algo
&gt;+
&gt;+    config_get proto &quot;${section}&quot; proto
&gt;+    config_get mesh &quot;${section}&quot; mesh
&gt;+    config_get routing_algo &quot;${section}&quot; routing_algo
&gt;+
&gt;+    if [ -z &quot;$mesh&quot; -o &quot;${proto}&quot; !=3D &quot;batadv&quot; ]; then
&gt;+        continue
&gt;+    fi
&gt;+
&gt;+    uci set network=2E&quot;${section}&quot;=2Eproto=3D&quot;batadv_hardif&quot;
&gt;+    uci rename network=2E&quot;${section}&quot;=2Emesh=3D&quot;master&quot;
&gt;+    uci delete network=2E&quot;${section}&quot;=2Erouting_algo
&gt;+
&gt;+    # create new section or adjust existing one
&gt;+    uci set network=2E&quot;${mesh}&quot;=3Dinterface
&gt;+    uci set network=2E&quot;${mesh}&quot;=2Eproto=3Dbatadv
&gt;+    [ -n &quot;${routing_algo}&quot; ]  &amp;&amp; uci set
&gt;network=2E&quot;${mesh}&quot;=2Erouting_algo=3D&quot;${routing_algo}&quot;
&gt;+}
&gt;+
&gt;+mv_batadv_config_section() {
&gt;+    local section=3D&quot;$1&quot;
&gt;+    local aggregated_ogms
&gt;+    local ap_isolation
&gt;+    local bonding
&gt;+    local bridge_loop_avoidance
&gt;+    local distributed_arp_table
&gt;+    local fragmentation
&gt;+    local gw_bandwidth
&gt;+    local gw_mode
&gt;+    local gw_sel_class
&gt;+    local hop_penalty
&gt;+    local isolation_mark
&gt;+    local log_level
&gt;+    local multicast_mode
&gt;+    local network_coding
&gt;+    local orig_interval
&gt;+
&gt;+    config_get aggregated_ogms &quot;${section}&quot; aggregated_ogms
&gt;+    config_get ap_isolation &quot;${section}&quot; ap_isolation
&gt;+    config_get bonding &quot;${section}&quot; bonding
&gt;+    config_get bridge_loop_avoidance &quot;${section}&quot;
&gt;bridge_loop_avoidance
&gt;+    config_get distributed_arp_table &quot;${section}&quot;
&gt;distributed_arp_table
&gt;+    config_get fragmentation &quot;${section}&quot; fragmentation
&gt;+    config_get gw_bandwidth &quot;${section}&quot; gw_bandwidth
&gt;+    config_get gw_mode &quot;${section}&quot; gw_mode
&gt;+    config_get gw_sel_class &quot;${section}&quot; gw_sel_class
&gt;+    config_get hop_penalty &quot;${section}&quot; hop_penalty
&gt;+    config_get isolation_mark &quot;${section}&quot; isolation_mark
&gt;+    config_get log_level &quot;${section}&quot; log_level
&gt;+    config_get multicast_mode &quot;${section}&quot; multicast_mode
&gt;+    config_get network_coding &quot;${section}&quot; network_coding
&gt;+    config_get orig_interval &quot;${section}&quot; orig_interval
&gt;+
&gt;+    # update section in case it exists
&gt;+    [ -n &quot;${aggregated_ogms}&quot; ]  &amp;&amp; uci set
&gt;network=2E&quot;${section}&quot;=2Eaggregated_ogms=3D&quot;${aggregated_ogms}&quot;
&gt;+    [ -n &quot;${ap_isolation}&quot; ]  &amp;&amp; uci set
&gt;network=2E&quot;${section}&quot;=2Eap_isolation=3D&quot;${ap_isolation}&quot;
&gt;+    [ -n &quot;${bonding}&quot; ]  &amp;&amp; uci set
&gt;network=2E&quot;${section}&quot;=2Ebonding=3D&quot;${bonding}&quot;
&gt;+    [ -n &quot;${bridge_loop_avoidance}&quot; ]  &amp;&amp; uci set
&gt;network=2E&quot;${section}&quot;=2Ebridge_loop_avoidance=3D&quot;${bridge_loop_avoidance=
}&quot;
&gt;+    [ -n &quot;${distributed_arp_table}&quot; ]  &amp;&amp; uci set
&gt;network=2E&quot;${section}&quot;=2Edistributed_arp_table=3D&quot;${distributed_arp_table=
}&quot;
&gt;+    [ -n &quot;${fragmentation}&quot; ]  &amp;&amp; uci set
&gt;network=2E&quot;${section}&quot;=2Efragmentation=3D&quot;${fragmentation}&quot;
&gt;+    [ -n &quot;${gw_bandwidth}&quot; ]  &amp;&amp; uci set
&gt;network=2E&quot;${section}&quot;=2Egw_bandwidth=3D&quot;${gw_bandwidth}&quot;
&gt;+    [ -n &quot;${gw_mode}&quot; ]  &amp;&amp; uci set
&gt;network=2E&quot;${section}&quot;=2Egw_mode=3D&quot;${gw_mode}&quot;
&gt;+    [ -n &quot;${gw_sel_class}&quot; ]  &amp;&amp; uci set
&gt;network=2E&quot;${section}&quot;=2Egw_sel_class=3D&quot;${gw_sel_class}&quot;
&gt;+    [ -n &quot;${hop_penalty}&quot; ]  &amp;&amp; uci set
&gt;network=2E&quot;${section}&quot;=2Ehop_penalty=3D&quot;${hop_penalty}&quot;
&gt;+    [ -n &quot;${isolation_mark}&quot; ]  &amp;&amp; uci set
&gt;network=2E&quot;${section}&quot;=2Eisolation_mark=3D&quot;${isolation_mark}&quot;
&gt;+    [ -n &quot;${log_level}&quot; ]  &amp;&amp; uci set
&gt;network=2E&quot;${section}&quot;=2Elog_level=3D&quot;${log_level}&quot;
&gt;+    [ -n &quot;${multicast_mode}&quot; ]  &amp;&amp; uci set
&gt;network=2E&quot;${section}&quot;=2Emulticast_mode=3D&quot;${multicast_mode}&quot;
&gt;+    [ -n &quot;${network_coding}&quot; ]  &amp;&amp; uci set
&gt;network=2E&quot;${section}&quot;=2Enetwork_coding=3D&quot;${network_coding}&quot;
&gt;+    [ -n &quot;${orig_interval}&quot; ]  &amp;&amp; uci set
&gt;network=2E&quot;${section}&quot;=2Eorig_interval=3D&quot;${orig_interval}&quot;
&gt;+}
&gt;+
&gt;+if [ -f /etc/config/batman-adv ]; then
&gt;+    config_load network
&gt;+    config_foreach proto_batadv_to_batadv_hardif 'interface'
&gt;+    uci commit network
&gt;+
&gt;+    config_load batman-adv
&gt;+    config_foreach mv_batadv_config_section 'mesh'
&gt;+    uci commit batman-adv
&gt;+
&gt;+    rm -f /etc/config/batman-adv
&gt;+fi
&gt;+
&gt;+exit 0
&gt;diff --git a/batman-adv/files/lib/batman-adv/config=2Esh
&gt;b/batman-adv/files/lib/batman-adv/config=2Esh
&gt;deleted file mode 100644
&gt;index 952f93e=2E=2E0000000
&gt;--- a/batman-adv/files/lib/batman-adv/config=2Esh
&gt;+++ /dev/null
&gt;@@ -1,69 +0,0 @@
&gt;-#!/bin/sh
&gt;-
&gt;-bat_load_module()
&gt;-{
&gt;-	[ -d &quot;/sys/module/batman_adv/&quot; ] &amp;&amp; return
&gt;-
&gt;-	=2E /lib/functions=2Esh
&gt;-	load_modules /etc/modules=2Ed/*-crc16 /etc/modules=2Ed/*-crypto*
&gt;/etc/modules=2Ed/*-lib-crc* /etc/modules=2Ed/*-batman-adv*
&gt;-}
&gt;-
&gt;-bat_config()
&gt;-{
&gt;-	local mesh=3D&quot;$1&quot;
&gt;-	local aggregated_ogms ap_isolation bonding bridge_loop_avoidance
&gt;distributed_arp_table fragmentation
&gt;-	local gw_bandwidth gw_mode gw_sel_class isolation_mark hop_penalty
&gt;multicast_mode network_coding log_level
&gt;-	local orig_interval
&gt;-
&gt;-	config_get aggregated_ogms &quot;$mesh&quot; aggregated_ogms
&gt;-	config_get ap_isolation &quot;$mesh&quot; ap_isolation
&gt;-	config_get bonding &quot;$mesh&quot; bonding
&gt;-	config_get bridge_loop_avoidance &quot;$mesh&quot; bridge_loop_avoidance
&gt;-	config_get distributed_arp_table &quot;$mesh&quot; distributed_arp_table
&gt;-	config_get fragmentation &quot;$mesh&quot; fragmentation
&gt;-	config_get gw_bandwidth &quot;$mesh&quot; gw_bandwidth
&gt;-	config_get gw_mode &quot;$mesh&quot; gw_mode
&gt;-	config_get gw_sel_class &quot;$mesh&quot; gw_sel_class
&gt;-	config_get hop_penalty &quot;$mesh&quot; hop_penalty
&gt;-	config_get isolation_mark &quot;$mesh&quot; isolation_mark
&gt;-	config_get multicast_mode &quot;$mesh&quot; multicast_mode
&gt;-	config_get network_coding &quot;$mesh&quot; network_coding
&gt;-	config_get log_level &quot;$mesh&quot; log_level
&gt;-	config_get orig_interval &quot;$mesh&quot; orig_interval
&gt;-
&gt;-	[ ! -f &quot;/sys/class/net/$mesh/mesh/orig_interval&quot; ] &amp;&amp; echo
&gt;&quot;batman-adv mesh $mesh does not exist - check your interface
&gt;configuration&quot; &amp;&amp; return 1
&gt;-
&gt;-	[ -n &quot;$aggregated_ogms&quot; ] &amp;&amp; batctl -m &quot;$mesh&quot; aggregation
&gt;&quot;$aggregated_ogms&quot;
&gt;-	[ -n &quot;$ap_isolation&quot; ] &amp;&amp; batctl -m &quot;$mesh&quot; ap_isolation
&gt;&quot;$ap_isolation&quot;
&gt;-	[ -n &quot;$bonding&quot; ] &amp;&amp; batctl -m &quot;$mesh&quot; bonding &quot;$bonding&quot;
&gt;-	[ -n &quot;$bridge_loop_avoidance&quot; ] &amp;&amp;  batctl -m &quot;$mesh&quot;
&gt;bridge_loop_avoidance &quot;$bridge_loop_avoidance&quot; 2&gt;&amp;-
&gt;-	[ -n &quot;$distributed_arp_table&quot; ] &amp;&amp; batctl -m &quot;$mesh&quot;
&gt;distributed_arp_table &quot;$distributed_arp_table&quot; 2&gt;&amp;-
&gt;-	[ -n &quot;$fragmentation&quot; ] &amp;&amp; batctl -m &quot;$mesh&quot; fragmentation
&gt;&quot;$fragmentation&quot;
&gt;-
&gt;-	case &quot;$gw_mode&quot; in
&gt;-	server)
&gt;-		if [ -n &quot;$gw_bandwidth&quot; ]; then
&gt;-			batctl -m &quot;$mesh&quot; gw_mode &quot;server&quot; &quot;$gw_bandwidth&quot;
&gt;-		else
&gt;-			batctl -m &quot;$mesh&quot; gw_mode &quot;server&quot;
&gt;-		fi
&gt;-		;;
&gt;-	client)
&gt;-		if [ -n &quot;$gw_sel_class&quot; ]; then
&gt;-			batctl -m &quot;$mesh&quot; gw_mode &quot;client&quot; &quot;$gw_sel_class&quot;
&gt;-		else
&gt;-			batctl -m &quot;$mesh&quot; gw_mode &quot;client&quot;
&gt;-		fi
&gt;-		;;
&gt;-	*)
&gt;-		batctl -m &quot;$mesh&quot; gw_mode &quot;off&quot;
&gt;-		;;
&gt;-	esac
&gt;-
&gt;-	[ -n &quot;$hop_penalty&quot; ] &amp;&amp; batctl -m &quot;$mesh&quot; hop_penalty &quot;$hop_penalty&quot;
&gt;-	[ -n &quot;$isolation_mark&quot; ] &amp;&amp; batctl -m &quot;$mesh&quot; isolation_mark
&gt;&quot;$isolation_mark&quot;
&gt;-	[ -n &quot;$multicast_mode&quot; ] &amp;&amp; batctl -m &quot;$mesh&quot; multicast_mode
&gt;&quot;$multicast_mode&quot; 2&gt;&amp;-
&gt;-	[ -n &quot;$network_coding&quot; ] &amp;&amp; batctl -m &quot;$mesh&quot; network_coding
&gt;&quot;$network_coding&quot; 2&gt;&amp;-
&gt;-	[ -n &quot;$log_level&quot; ] &amp;&amp; batctl -m &quot;$mesh&quot; loglevel &quot;$log_level&quot; 2&gt;&amp;-
&gt;-	[ -n &quot;$orig_interval&quot; ] &amp;&amp; batctl -m &quot;$mesh&quot; orig_interval
&gt;&quot;$orig_interval&quot;
&gt;-}
&gt;diff --git a/batman-adv/files/lib/netifd/proto/batadv=2Esh
&gt;b/batman-adv/files/lib/netifd/proto/batadv=2Esh
&gt;index 2233091=2E=2Eeb8153c 100755
&gt;--- a/batman-adv/files/lib/netifd/proto/batadv=2Esh
&gt;+++ b/batman-adv/files/lib/netifd/proto/batadv=2Esh
&gt;@@ -1,37 +1,119 @@
&gt; #!/bin/sh
&gt;=20
&gt;-=2E /lib/functions=2Esh
&gt;-=2E =2E=2E/netifd-proto=2Esh
&gt;-init_proto &quot;$@&quot;
&gt;+[ -n &quot;$INCLUDE_ONLY&quot; ] || {
&gt;+	=2E /lib/functions=2Esh
&gt;+	=2E =2E=2E/netifd-proto=2Esh
&gt;+	init_proto &quot;$@&quot;
&gt;+}
&gt;=20
&gt; proto_batadv_init_config() {
&gt;-	proto_config_add_string &quot;mesh&quot;
&gt;-	proto_config_add_string &quot;routing_algo&quot;
&gt;+	no_device=3D1
&gt;+	available=3D1
&gt;+
&gt;+	proto_config_add_boolean 'aggregated_ogms:bool'
&gt;+	proto_config_add_boolean 'ap_isolation:bool'
&gt;+	proto_config_add_boolean 'bonding:bool'
&gt;+	proto_config_add_boolean 'bridge_loop_avoidance:bool'
&gt;+	proto_config_add_boolean 'distributed_arp_table:bool'
&gt;+	proto_config_add_boolean 'fragmentation:bool'
&gt;+	proto_config_add_string 'gw_bandwidth'
&gt;+	proto_config_add_string 'gw_mode'
&gt;+	proto_config_add_int 'gw_sel_class'
&gt;+	proto_config_add_int 'hop_penalty'
&gt;+	proto_config_add_string 'isolation_mark'
&gt;+	proto_config_add_string 'log_level'
&gt;+	proto_config_add_boolean 'multicast_mode:bool'
&gt;+	proto_config_add_boolean 'network_coding:bool'
&gt;+	proto_config_add_int 'orig_interval'
&gt;+	proto_config_add_string 'routing_algo'
&gt; }
&gt;=20
&gt; proto_batadv_setup() {
&gt; 	local config=3D&quot;$1&quot;
&gt;-	local iface=3D&quot;$2&quot;
&gt;+	local iface=3D&quot;$config&quot;
&gt;+
&gt;+	local aggregated_ogms
&gt;+	local ap_isolation
&gt;+	local bonding
&gt;+	local bridge_loop_avoidance
&gt;+	local distributed_arp_table
&gt;+	local fragmentation
&gt;+	local gw_bandwidth
&gt;+	local gw_mode
&gt;+	local gw_sel_class
&gt;+	local hop_penalty
&gt;+	local isolation_mark
&gt;+	local log_level
&gt;+	local multicast_mode
&gt;+	local network_coding
&gt;+	local orig_interval
&gt;+	local routing_algo
&gt;+
&gt;+	json_get_vars aggregated_ogms
&gt;+	json_get_vars ap_isolation
&gt;+	json_get_vars bonding
&gt;+	json_get_vars bridge_loop_avoidance
&gt;+	json_get_vars distributed_arp_table
&gt;+	json_get_vars fragmentation
&gt;+	json_get_vars gw_bandwidth
&gt;+	json_get_vars gw_mode
&gt;+	json_get_vars gw_sel_class
&gt;+	json_get_vars hop_penalty
&gt;+	json_get_vars isolation_mark
&gt;+	json_get_vars log_level
&gt;+	json_get_vars multicast_mode
&gt;+	json_get_vars network_coding
&gt;+	json_get_vars orig_interval
&gt;+	json_get_vars routing_algo
&gt;=20
&gt;-	local mesh routing_algo
&gt;-	json_get_vars mesh routing_algo
&gt;+	set_default routing_algo 'BATMAN_IV'
&gt;=20
&gt;-	[ -n &quot;$routing_algo&quot; ] || routing_algo=3D&quot;BATMAN_IV&quot;
&gt; 	batctl routing_algo &quot;$routing_algo&quot;
&gt;+	batctl -m &quot;$iface&quot; interface create
&gt;+
&gt;+	[ -n &quot;$aggregated_ogms&quot; ] &amp;&amp; batctl -m &quot;$iface&quot; aggregation
&gt;&quot;$aggregated_ogms&quot;
&gt;+	[ -n &quot;$ap_isolation&quot; ] &amp;&amp; batctl -m &quot;$iface&quot; ap_isolation
&gt;&quot;$ap_isolation&quot;
&gt;+	[ -n &quot;$bonding&quot; ] &amp;&amp; batctl -m &quot;$iface&quot; bonding &quot;$bonding&quot;
&gt;+	[ -n &quot;$bridge_loop_avoidance&quot; ] &amp;&amp;  batctl -m &quot;$iface&quot;
&gt;bridge_loop_avoidance &quot;$bridge_loop_avoidance&quot; 2&gt;&amp;-
&gt;+	[ -n &quot;$distributed_arp_table&quot; ] &amp;&amp; batctl -m &quot;$iface&quot;
&gt;distributed_arp_table &quot;$distributed_arp_table&quot; 2&gt;&amp;-
&gt;+	[ -n &quot;$fragmentation&quot; ] &amp;&amp; batctl -m &quot;$iface&quot; fragmentation
&gt;&quot;$fragmentation&quot;
&gt;+
&gt;+	case &quot;$gw_mode&quot; in
&gt;+	server)
&gt;+		if [ -n &quot;$gw_bandwidth&quot; ]; then
&gt;+			batctl -m &quot;$iface&quot; gw_mode &quot;server&quot; &quot;$gw_bandwidth&quot;
&gt;+		else
&gt;+			batctl -m &quot;$iface&quot; gw_mode &quot;server&quot;
&gt;+		fi
&gt;+		;;
&gt;+	client)
&gt;+		if [ -n &quot;$gw_sel_class&quot; ]; then
&gt;+			batctl -m &quot;$iface&quot; gw_mode &quot;client&quot; &quot;$gw_sel_class&quot;
&gt;+		else
&gt;+			batctl -m &quot;$iface&quot; gw_mode &quot;client&quot;
&gt;+		fi
&gt;+		;;
&gt;+	*)
&gt;+		batctl -m &quot;$iface&quot; gw_mode &quot;off&quot;
&gt;+		;;
&gt;+	esac
&gt;+
&gt;+	[ -n &quot;$hop_penalty&quot; ] &amp;&amp; batctl -m &quot;$iface&quot; hop_penalty
&gt;&quot;$hop_penalty&quot;
&gt;+	[ -n &quot;$isolation_mark&quot; ] &amp;&amp; batctl -m &quot;$iface&quot; isolation_mark
&gt;&quot;$isolation_mark&quot;
&gt;+	[ -n &quot;$multicast_mode&quot; ] &amp;&amp; batctl -m &quot;$iface&quot; multicast_mode
&gt;&quot;$multicast_mode&quot; 2&gt;&amp;-
&gt;+	[ -n &quot;$network_coding&quot; ] &amp;&amp; batctl -m &quot;$iface&quot; network_coding
&gt;&quot;$network_coding&quot; 2&gt;&amp;-
&gt;+	[ -n &quot;$log_level&quot; ] &amp;&amp; batctl -m &quot;$iface&quot; loglevel &quot;$log_level&quot; 2&gt;&amp;-
&gt;+	[ -n &quot;$orig_interval&quot; ] &amp;&amp; batctl -m &quot;$iface&quot; orig_interval
&gt;&quot;$orig_interval&quot;
&gt;=20
&gt;-	batctl -m &quot;$mesh&quot; interface add &quot;$iface&quot;
&gt; 	proto_init_update &quot;$iface&quot; 1
&gt; 	proto_send_update &quot;$config&quot;
&gt; }
&gt;=20
&gt; proto_batadv_teardown() {
&gt; 	local config=3D&quot;$1&quot;
&gt;-	local iface=3D&quot;$2&quot;
&gt;-
&gt;-	local mesh
&gt;-	json_get_vars mesh
&gt;+	local iface=3D&quot;$config&quot;
&gt;=20
&gt;-	batctl -m &quot;$mesh&quot; interface del &quot;$iface&quot; || true
&gt;+	batctl -m &quot;$iface&quot; interface destroy
&gt; }
&gt;=20
&gt; add_protocol batadv
&gt;diff --git a/batman-adv/files/lib/netifd/proto/batadv_hardif=2Esh
&gt;b/batman-adv/files/lib/netifd/proto/batadv_hardif=2Esh
&gt;new file mode 100755
&gt;index 0000000=2E=2E9283d2b
&gt;--- /dev/null
&gt;+++ b/batman-adv/files/lib/netifd/proto/batadv_hardif=2Esh
&gt;@@ -0,0 +1,40 @@
&gt;+#!/bin/sh
&gt;+
&gt;+[ -n &quot;$INCLUDE_ONLY&quot; ] || {
&gt;+	=2E /lib/functions=2Esh
&gt;+	=2E =2E=2E/netifd-proto=2Esh
&gt;+	init_proto &quot;$@&quot;
&gt;+}
&gt;+
&gt;+proto_batadv_hardif_init_config() {
&gt;+	proto_config_add_string &quot;master&quot;
&gt;+}
&gt;+
&gt;+proto_batadv_hardif_setup() {
&gt;+	local config=3D&quot;$1&quot;
&gt;+	local iface=3D&quot;$2&quot;
&gt;+
&gt;+	local master
&gt;+
&gt;+	json_get_vars master
&gt;+
&gt;+	( proto_add_host_dependency &quot;$config&quot; '' &quot;$master&quot; )
&gt;+
&gt;+	batctl -m &quot;$master&quot; interface -M add &quot;$iface&quot;
&gt;+
&gt;+	proto_init_update &quot;$iface&quot; 1
&gt;+	proto_send_update &quot;$config&quot;
&gt;+}
&gt;+
&gt;+proto_batadv_hardif_teardown() {
&gt;+	local config=3D&quot;$1&quot;
&gt;+	local iface=3D&quot;$2&quot;
&gt;+
&gt;+	local master
&gt;+
&gt;+	json_get_vars master
&gt;+
&gt;+	batctl -m &quot;$master&quot; interface -M del &quot;$iface&quot; || true
&gt;+}
&gt;+
&gt;+add_protocol batadv_hardif

]