Skip to contentSkip to conversation

openwrt-feed-batman-adv: enable batadv_vlan protocol

PATCH Applied Antonio Quartulli 3 participants 3 messages May 19, 2014 – Jun 2, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 openwrt-feed-batman-adv: enable batadv_vlan protocol

From: Antonio Quartulli <[email protected]>

This protocol can be used to change VLAN-specific settings of a batman-adv soft-interface.
At the moment only ap_isolation is available, but new ones can be easily added as soon as batman-adv get to support more.

Interface configuration example:

config interface 'bat0vlan1'
option protocol 'batadv_vlan'
option ifname 'bat0.1'
option ap_isolation '1'

---

**this patch has been tested only with the stable package in openwrt-routing**

 batman-adv-devel/Makefile                          |  1 +
 .../files/lib/netifd/proto/batadv_vlan.sh          | 29 ++++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 batman-adv-devel/files/lib/netifd/proto/batadv_vlan.sh
batman-adv-devel/Makefile +1 -0
index e8b0881..76f5861 100644
@@ -78,6 +78,7 @@ define KernelPackage/batman-adv-devel/install
 	$(INSTALL_DATA) ./files/lib/batman-adv/config.sh $(1)/lib/batman-adv
 	$(INSTALL_BIN) ./files/etc/hotplug.d/net/99-batman-adv $(1)/etc/hotplug.d/net
 	$(INSTALL_BIN) ./files/lib/netifd/proto/batadv.sh $(1)/lib/netifd/proto
+	$(INSTALL_BIN) ./files/lib/netifd/proto/batadv_vlan.sh $(1)/lib/netifd/proto
 endef
 
 $(eval $(call KernelPackage,batman-adv-devel))
batman-adv-devel/files/lib/netifd/proto/batadv_vlan.sh new file +29 -0
new file mode 100644
index 0000000..85002c3
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+. /lib/functions.sh
+. ../netifd-proto.sh
+init_proto "$@"
+
+proto_batadv_vlan_init_config() {
+	proto_config_add_string "ap_isolation"
+}
+
+proto_batadv_vlan_setup() {
+	local config="$1"
+	local iface="$2"
+
+	# VLAN specific variables
+	local device="${iface%.*}"
+	local vid="${iface#*.}"
+
+	# batadv_vlan options
+	local ap_isolation
+
+	json_get_vars ap_isolation
+
+	echo "$ap_isolation" > "/sys/class/net/${device}/mesh/vlan${vid}/ap_isolation"
+	proto_init_update "$iface" 1
+	proto_send_update "$config"
+}
+
+add_protocol batadv_vlan
Signature · 1 line
1.8.5.5
#1 lore raw
Quoted 7 lines · On Monday 19 May 2014 10:52:01 Antonio Quartulli wrote:

From: Antonio Quartulli <[email protected]>

This protocol can be used to change VLAN-specific settings of a batman-adv soft-interface.
At the moment only ap_isolation is available, but new ones can be easily added as soon as batman-adv get to support more.

Quoted 6 lines

Interface configuration example:

config interface 'bat0vlan1'
option protocol 'batadv_vlan'
option ifname 'bat0.1'
option ap_isolation '1'

Applied in revision 26284d3.

How about moving this documentation to the OpenWrt config page in our wiki ?
http://www.open-mesh.org/projects/batman-adv/wiki/Batman-adv-openwrt-config

Thanks,
Marek