[PATCH v2 18/33] factor out ifconfig for use with macvlan

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Michael Braun <michael-dev@xxxxxxxxxxxxx>
---
 hostapd/Makefile       |  6 +++++-
 src/ap/vlan_full.c     |  8 +-------
 src/ap/vlan_ifconfig.c |  9 ++++++++-
 src/ap/vlan_ifconfig.h | 16 ++++++++++++++++
 src/ap/vlan_init.c     |  1 +
 src/ap/vlan_util.h     |  3 ---
 6 files changed, 31 insertions(+), 12 deletions(-)
 create mode 100644 src/ap/vlan_ifconfig.h

diff --git a/hostapd/Makefile b/hostapd/Makefile
index 46dffe5..20f7ef3 100644
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
@@ -200,8 +200,8 @@ ifdef CONFIG_NO_VLAN
 CFLAGS += -DCONFIG_NO_VLAN
 else
 OBJS += ../src/ap/vlan_init.o
-OBJS += ../src/ap/vlan_ifconfig.o
 OBJS += ../src/ap/vlan.o
+NEED_IFCONFIG=y
 ifdef CONFIG_FULL_DYNAMIC_VLAN
 # Define CONFIG_FULL_DYNAMIC_VLAN to have hostapd manipulate bridges
 # and VLAN interfaces for the VLAN feature.
@@ -215,6 +215,10 @@ endif
 endif
 endif
 
+ifdef NEED_IFCONFIG
+OBJS += ../src/ap/vlan_ifconfig.o
+endif
+
 ifdef CONFIG_NO_CTRL_IFACE
 CFLAGS += -DCONFIG_NO_CTRL_IFACE
 else
diff --git a/src/ap/vlan_full.c b/src/ap/vlan_full.c
index aa42335..3740857 100644
--- a/src/ap/vlan_full.c
+++ b/src/ap/vlan_full.c
@@ -25,6 +25,7 @@
 #include "wpa_auth.h"
 #include "vlan_init.h"
 #include "vlan_util.h"
+#include "vlan_ifconfig.h"
 
 
 struct full_dynamic_vlan {
@@ -116,13 +117,6 @@ static int dyn_iface_put(struct hostapd_data *hapd, const char *ifname)
 }
 
 
-static int ifconfig_down(const char *if_name)
-{
-	wpa_printf(MSG_DEBUG, "VLAN: Set interface %s down", if_name);
-	return ifconfig_helper(if_name, 0);
-}
-
-
 /* This value should be 256 ONLY. If it is something else, then hostapd
  * might crash!, as this value has been hard-coded in 2.4.x kernel
  * bridging code.
diff --git a/src/ap/vlan_ifconfig.c b/src/ap/vlan_ifconfig.c
index ef953a5..0295ec5 100644
--- a/src/ap/vlan_ifconfig.c
+++ b/src/ap/vlan_ifconfig.c
@@ -16,7 +16,7 @@
 #include "vlan_util.h"
 
 
-int ifconfig_helper(const char *if_name, int up)
+static int ifconfig_helper(const char *if_name, int up)
 {
 	int fd;
 	struct ifreq ifr;
@@ -67,3 +67,10 @@ int iface_exists(const char *ifname)
 {
 	return if_nametoindex(ifname);
 }
+
+
+int ifconfig_down(const char *if_name)
+{
+	wpa_printf(MSG_DEBUG, "VLAN: Set interface %s down", if_name);
+	return ifconfig_helper(if_name, 0);
+}
diff --git a/src/ap/vlan_ifconfig.h b/src/ap/vlan_ifconfig.h
new file mode 100644
index 0000000..53c3fa2
--- /dev/null
+++ b/src/ap/vlan_ifconfig.h
@@ -0,0 +1,16 @@
+/*
+ * hostapd / VLAN ifconfig helpers
+ * Copyright 2003, Instant802 Networks, Inc.
+ * Copyright 2005-2006, Devicescape Software, Inc.
+ * Copyright (c) 2009, Jouni Malinen <j@xxxxx>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#ifndef HOSTAPD_VLAN_IFCONFIG_H
+#define HOSTAPD_VLAN_IFCONFIG_H
+int ifconfig_up(const char *if_name);
+int iface_exists(const char *ifname);
+int ifconfig_down(const char *if_name);
+#endif /* HOSTAPD_VLAN_IFCONFIG_H */
diff --git a/src/ap/vlan_init.c b/src/ap/vlan_init.c
index 31e4fc6..f931f67 100644
--- a/src/ap/vlan_init.c
+++ b/src/ap/vlan_init.c
@@ -17,6 +17,7 @@
 #include "wpa_auth.h"
 #include "vlan_init.h"
 #include "vlan_util.h"
+#include "vlan_ifconfig.h"
 
 
 static int vlan_if_add(struct hostapd_data *hapd, struct hostapd_vlan *vlan,
diff --git a/src/ap/vlan_util.h b/src/ap/vlan_util.h
index 2446859..6a541d4 100644
--- a/src/ap/vlan_util.h
+++ b/src/ap/vlan_util.h
@@ -17,9 +17,6 @@ int vlan_add(const char *if_name, int vid, const char *vlan_if_name);
 int vlan_rem(const char *if_name);
 int vlan_set_name_type(unsigned int name_type);
 
-int ifconfig_helper(const char *if_name, int up);
-int ifconfig_up(const char *if_name);
-int iface_exists(const char *ifname);
 int vlan_if_remove(struct hostapd_data *hapd, struct hostapd_vlan *vlan);
 
 struct full_dynamic_vlan *
-- 
2.1.4


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux