[arch-commits] Commit in hostapd/trunk (PKGBUILD config openvswitch.patch)

Sergej Pupykin spupykin at archlinux.org
Wed Mar 25 12:40:15 UTC 2015


    Date: Wednesday, March 25, 2015 @ 13:40:15
  Author: spupykin
Revision: 129896

upgpkg: hostapd 2.4-2

upd

Added:
  hostapd/trunk/openvswitch.patch
Modified:
  hostapd/trunk/PKGBUILD
  hostapd/trunk/config

-------------------+
 PKGBUILD          |   10 +--
 config            |    2 
 openvswitch.patch |  153 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 160 insertions(+), 5 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2015-03-25 12:04:39 UTC (rev 129895)
+++ PKGBUILD	2015-03-25 12:40:15 UTC (rev 129896)
@@ -3,7 +3,7 @@
 
 pkgname=hostapd
 pkgver=2.4
-pkgrel=1
+pkgrel=2
 pkgdesc="IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator"
 arch=('i686' 'x86_64')
 url="http://w1.fi/hostapd/"
@@ -15,17 +15,17 @@
 	config
 	hostapd.service
 	hostapd-2.3-noscan.patch
-	https://github.com/hschaa/hostapd/commit/c89daaeca4ee90c8bc158e37acb.patch)
+	openvswitch.patch)
 md5sums=('04578f3f2c3eb1bec1adf30473813912'
-         '72e8ecf8fadf8b06d87876ea8c3dfd07'
+         '43c0ec1d8b4d4e46f468bc161bb05c4b'
          '380042b9cf4950e34ed34b3093ab9e7f'
          'eaf8e48a9a63b5902fddadff2b8933fa'
-         '7781a6d3fbc7da53720074b51225e426')
+         'a0802a604ed957078da0e14863df74f0')
 
 prepare() {
   cd $pkgname-$pkgver
   patch -p1 <$srcdir/hostapd-2.3-noscan.patch
-  patch -p1 <$srcdir/c89daaeca4ee90c8bc158e37acb.patch
+  patch -p1 <$srcdir/openvswitch.patch
 }
 
 build() {

Modified: config
===================================================================
--- config	2015-03-25 12:04:39 UTC (rev 129895)
+++ config	2015-03-25 12:40:15 UTC (rev 129896)
@@ -94,3 +94,5 @@
 CONFIG_ACS=y
 
 CONFIG_IEEE80211AC=y
+
+CONFIG_OPENVSWITCH=y

Added: openvswitch.patch
===================================================================
--- openvswitch.patch	                        (rev 0)
+++ openvswitch.patch	2015-03-25 12:40:15 UTC (rev 129896)
@@ -0,0 +1,153 @@
+diff --git a/src/drivers/drivers.mak b/src/drivers/drivers.mak
+index 9434078..7d8786c 100644
+--- a/src/drivers/drivers.mak
++++ b/src/drivers/drivers.mak
+@@ -145,6 +145,10 @@ DRV_WPA_OBJS += ../src/drivers/driver_wext.o
+ NEED_RFKILL=y
+ endif
+ 
++ifdef CONFIG_OPENVSWITCH
++DRV_CFLAGS += -DCONFIG_OPENVSWITCH
++endif
++
+ ifdef NEED_NETLINK
+ DRV_OBJS += ../src/drivers/netlink.o
+ endif
+diff --git a/src/drivers/drivers.mk b/src/drivers/drivers.mk
+index 8da4c53..4cee638 100644
+--- a/src/drivers/drivers.mk
++++ b/src/drivers/drivers.mk
+@@ -132,6 +132,10 @@ DRV_WPA_OBJS += src/drivers/driver_wext.c
+ NEED_RFKILL=y
+ endif
+ 
++ifdef CONFIG_OPENVSWITCH
++DRV_CFLAGS += -DCONFIG_OPENVSWITCH
++endif
++
+ ifdef NEED_NETLINK
+ DRV_OBJS += src/drivers/netlink.c
+ endif
+diff --git a/src/drivers/linux_ioctl.c b/src/drivers/linux_ioctl.c
+index 837971d..f666e27 100644
+--- a/src/drivers/linux_ioctl.c
++++ b/src/drivers/linux_ioctl.c
+@@ -14,6 +14,69 @@
+ #include "utils/common.h"
+ #include "linux_ioctl.h"
+ 
++#ifdef CONFIG_OPENVSWITCH
++#include <sys/wait.h>
++#include <sys/stat.h>
++
++#define run_prog(p, ...) ({ \
++	struct stat q; \
++	int rc = -1, status; \
++	if(stat(p, &q) == 0) \
++	{ \
++		pid_t pid = fork(); \
++		if (!pid) \
++			exit(execl(p, p, ##__VA_ARGS__, NULL)); \
++		if (pid < 0) { \
++			rc = -1; \
++		} else { \
++			while ((rc = waitpid(pid, &status, 0)) == -1 && errno == EINTR); \
++			rc = (rc == pid && WIFEXITED(status)) ? WEXITSTATUS(status) : -1; \
++		} \
++	} \
++	rc; \
++})
++
++int ovs_br_get(char *brname, const char *ifname)
++{
++	FILE *f;
++	char cmd[64];
++	char *c;
++	struct stat q;
++
++	if(stat("/usr/bin/ovs-vsctl", &q) != 0)
++		return -1;
++
++	brname[0] = '\0';
++	sprintf(cmd, "/usr/bin/ovs-vsctl iface-to-br %s", ifname);
++	f = popen(cmd, "r");
++	if (!f)
++		return -1;
++	c = fgets(brname, IFNAMSIZ, f);
++	pclose(f);
++	if (c && strlen(brname)) {
++		/* Ignore newline */
++		if ((c = strchr(brname, '\n')))
++			*c = '\0';
++		return 0;
++	}
++	return -1;
++}
++
++int ovs_br_add_if(const char *brname, const char *ifname)
++{
++	if (run_prog("/usr/bin/ovs-vsctl", "add-port", brname, ifname))
++		return -1;
++	return 0;
++}
++
++int ovs_br_del_if(const char *brname, const char *ifname)
++{
++	if (run_prog("/usr/bin/ovs-vsctl", "del-port", brname, ifname))
++		return -1;
++	return 0;
++}
++
++#endif
+ 
+ int linux_set_iface_flags(int sock, const char *ifname, int dev_up)
+ {
+@@ -118,7 +181,6 @@ int linux_set_ifhwaddr(int sock, const char *ifname, const u8 *addr)
+ 	return 0;
+ }
+ 
+-
+ #ifndef SIOCBRADDBR
+ #define SIOCBRADDBR 0x89a0
+ #endif
+@@ -162,6 +224,11 @@ int linux_br_add_if(int sock, const char *brname, const char *ifname)
+ 	struct ifreq ifr;
+ 	int ifindex;
+ 
++#ifdef CONFIG_OPENVSWITCH
++	if (!ovs_br_add_if(brname, ifname))
++		return 0;
++#endif
++
+ 	ifindex = if_nametoindex(ifname);
+ 	if (ifindex == 0)
+ 		return -1;
+@@ -184,6 +251,11 @@ int linux_br_del_if(int sock, const char *brname, const char *ifname)
+ 	struct ifreq ifr;
+ 	int ifindex;
+ 
++#ifdef CONFIG_OPENVSWITCH
++	if (!ovs_br_del_if(brname, ifname))
++		return 0;
++#endif
++
+ 	ifindex = if_nametoindex(ifname);
+ 	if (ifindex == 0)
+ 		return -1;
+@@ -206,6 +278,11 @@ int linux_br_get(char *brname, const char *ifname)
+ 	char path[128], brlink[128], *pos;
+ 	ssize_t res;
+ 
++#ifdef CONFIG_OPENVSWITCH
++	if (!ovs_br_get(brname, ifname))
++		return 0;
++#endif
++
+ 	os_snprintf(path, sizeof(path), "/sys/class/net/%s/brport/bridge",
+ 		    ifname);
+ 	res = readlink(path, brlink, sizeof(brlink));
+@@ -219,3 +296,4 @@ int linux_br_get(char *brname, const char *ifname)
+ 	os_strlcpy(brname, pos, IFNAMSIZ);
+ 	return 0;
+ }
++



More information about the arch-commits mailing list