Patchwork [v2,1/4] add configure option to set vlan naming scheme

login
register
mail settings
Submitter michael-dev@fami-braun.de
Date Aug. 9, 2012, 9:55 a.m.
Message ID <20120809095501.14256.94045.stgit@localhost6.localdomain6>
Download mbox | patch
Permalink /patch/176039/
State Accepted
Headers show

Comments

michael-dev@fami-braun.de - Aug. 9, 2012, 9:55 a.m.
---
 hostapd/config_file.c |    9 +++++++++
 hostapd/hostapd.conf  |    6 ++++++
 src/ap/ap_config.h    |    4 ++++
 3 files changed, 19 insertions(+)

Patch

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 03f29ad..b5315a5 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2133,6 +2133,15 @@  static int hostapd_config_fill(struct hostapd_config *conf,
 					   "read VLAN file '%s'", line, pos);
 				errors++;
 			}
+		} else if (os_strcmp(buf, "vlan_naming") == 0) {
+			bss->ssid.vlan_naming = atoi(pos);
+			if (bss->ssid.vlan_naming >= DYNAMIC_VLAN_NAMING_END
+			 || bss->ssid.vlan_naming < 0) {
+				wpa_printf(MSG_ERROR, "Line %d: invalid naming "
+					   "scheme %d", line,
+                                           bss->ssid.vlan_naming);
+				errors++;
+                        }
 #ifdef CONFIG_FULL_DYNAMIC_VLAN
 		} else if (os_strcmp(buf, "vlan_tagged_interface") == 0) {
 			bss->ssid.vlan_tagged_interface = os_strdup(pos);
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index 7e4e5d2..1ffdf8a 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -801,6 +801,12 @@  own_ip_addr=127.0.0.1
 # to the bridge.
 #vlan_tagged_interface=eth0
 
+# When hostapd creates a vlan interface on vlan_tagged_interfaces, it needs
+# to know how name it.
+# 0 = vlan<XXX>, e.g. vlan1
+# 1 = <vlan_tagged_interface>.<XXX>, e.g. eth0.1
+#vlan_naming=0
+
 # Arbitrary RADIUS attributes can be added into Access-Request and
 # Accounting-Request packets by specifying the contents of the attributes with
 # the following configuration parameters. There can be multiple of these to
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index bfb2d8a..9a546ee 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -65,6 +65,10 @@  struct hostapd_ssid {
 #define DYNAMIC_VLAN_OPTIONAL 1
 #define DYNAMIC_VLAN_REQUIRED 2
 	int dynamic_vlan;
+#define DYNAMIC_VLAN_NAMING_WITHOUT_DEVICE 0
+#define DYNAMIC_VLAN_NAMING_WITH_DEVICE 1
+#define DYNAMIC_VLAN_NAMING_END 2
+	int vlan_naming;
 #ifdef CONFIG_FULL_DYNAMIC_VLAN
 	char *vlan_tagged_interface;
 #endif /* CONFIG_FULL_DYNAMIC_VLAN */