public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@meshcoding.com>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Antonio Quartulli <antonio@open-mesh.com>
Subject: [B.A.T.M.A.N.] [PATCH] openwrt-feed-batman-adv: enable batadv_vlan protocol
Date: Mon, 19 May 2014 10:52:01 +0200	[thread overview]
Message-ID: <1400489521-22006-1-git-send-email-antonio@meshcoding.com> (raw)

From: Antonio Quartulli <antonio@open-mesh.com>

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'

Cc: Bastian Bittorf <bittorf@bluebottle.com>
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
---

**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

diff --git a/batman-adv-devel/Makefile b/batman-adv-devel/Makefile
index e8b0881..76f5861 100644
--- a/batman-adv-devel/Makefile
+++ b/batman-adv-devel/Makefile
@@ -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))
diff --git a/batman-adv-devel/files/lib/netifd/proto/batadv_vlan.sh b/batman-adv-devel/files/lib/netifd/proto/batadv_vlan.sh
new file mode 100644
index 0000000..85002c3
--- /dev/null
+++ b/batman-adv-devel/files/lib/netifd/proto/batadv_vlan.sh
@@ -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
-- 
1.8.5.5


             reply	other threads:[~2014-05-19  8:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-19  8:52 Antonio Quartulli [this message]
2014-06-02 16:20 ` [B.A.T.M.A.N.] [PATCH] openwrt-feed-batman-adv: enable batadv_vlan protocol Marek Lindner
2014-06-02 19:14   ` Antonio Quartulli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1400489521-22006-1-git-send-email-antonio@meshcoding.com \
    --to=antonio@meshcoding.com \
    --cc=antonio@open-mesh.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox