[PATCH 1/4] add configure option to set vlan naming scheme

Michael Braun michael-dev
Sat Jul 7 01:52:06 PDT 2012


---
 hostapd/config_file.c |    9 +++++++++
 hostapd/hostapd.conf  |    6 ++++++
 src/ap/ap_config.h    |    4 ++++
 3 files changed, 19 insertions(+)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index eebbaa6..65f4c4a 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2120,6 +2120,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 494f7ca..30b9bc9 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -796,6 +796,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 ca4fe58..87b0984 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 */




More information about the Hostap mailing list