[PATCH] wpa_supplicant: fix FTBFS on Debian GNU/kFreebsd

Kel Modderman kel
Sun Feb 28 04:29:12 PST 2010


Hi Jouni,

This patch allows wpa_supplicant to compile on Debian's kfreebsd architectures.

Patch by Stefan Lippers-Hollmann based on work done by Petr Salinger and
Emmanuel Bouthenot for 0.6.X (http://bugs.debian.org/480572).

Thanks, Kel.
---
--- a/src/drivers/driver_bsd.c
+++ b/src/drivers/driver_bsd.c
@@ -35,11 +35,15 @@
 #include <netproto/802_11/ieee80211_ioctl.h>
 #include <netproto/802_11/ieee80211_dragonfly.h>
 #else /* __DragonFly__ */
+#ifdef __GLIBC__
+#include <netinet/ether.h>
+#include <bsd/string.h>
+#endif /* __GLIBC__ */
 #include <net80211/ieee80211.h>
 #include <net80211/ieee80211_ioctl.h>
 #include <net80211/ieee80211_crypto.h>
-#endif /* __DragonFly__ */
-#if __FreeBSD__
+#endif /* __DragonFly__ || __GLIBC__ */
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 #include <net80211/ieee80211_freebsd.h>
 #endif
 #if __NetBSD__
--- a/src/drivers/driver_wired.c
+++ b/src/drivers/driver_wired.c
@@ -21,9 +21,9 @@
 #include <net/if_arp.h>
 #include <net/if.h>
 #endif /* __linux__ */
-#if defined(__FreeBSD__) || defined(__DragonFly__)
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
 #include <net/if_dl.h>
-#endif /* defined(__FreeBSD__) || defined(__DragonFly__) */
+#endif /* defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) */
 
 #include "common.h"
 #include "eloop.h"
@@ -474,7 +474,7 @@ static int wpa_driver_wired_multi(const
 	ifr.ifr_hwaddr.sa_family = AF_UNSPEC;
 	os_memcpy(ifr.ifr_hwaddr.sa_data, addr, ETH_ALEN);
 #endif /* __linux__ */
-#if defined(__FreeBSD__) || defined(__DragonFly__)
+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
 	{
 		struct sockaddr_dl *dlp;
 		dlp = (struct sockaddr_dl *) &ifr.ifr_addr;
@@ -486,7 +486,7 @@ static int wpa_driver_wired_multi(const
 		dlp->sdl_slen = 0;
 		os_memcpy(LLADDR(dlp), addr, ETH_ALEN);
 	}
-#endif /* defined(__FreeBSD__) || defined(__DragonFly__) */
+#endif /* defined(__FreeBSD__) || defined(__DragonFly__) || defined(FreeBSD_kernel__) */
 #if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
 	{
 		struct sockaddr *sap;
--- a/src/l2_packet/l2_packet_freebsd.c
+++ b/src/l2_packet/l2_packet_freebsd.c
@@ -14,7 +14,7 @@
  */
 
 #include "includes.h"
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__GLIBC__)
 #include <net/bpf.h>
 #endif /* __APPLE__ */
 #include <pcap.h>
--- a/src/utils/common.h
+++ b/src/utils/common.h
@@ -17,7 +17,7 @@
 
 #include "os.h"
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
 #include <endian.h>
 #include <byteswap.h>
 #endif /* __linux__ */
--- a/src/wps/wps_upnp.c
+++ b/src/wps/wps_upnp.c
@@ -797,7 +797,7 @@ fail:
 }
 
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 #include <sys/sysctl.h>
 #include <net/route.h>
 #include <net/if_dl.h>
@@ -884,7 +884,7 @@ int get_netif_info(const char *net_if, u
 		goto fail;
 	}
 	os_memcpy(mac, req.ifr_addr.sa_data, 6);
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 	if (eth_get(net_if, mac) < 0) {
 		wpa_printf(MSG_ERROR, "WPS UPnP: Failed to get MAC address");
 		goto fail;
--- a/wpa_supplicant/ctrl_iface_unix.c
+++ b/wpa_supplicant/ctrl_iface_unix.c
@@ -346,7 +346,7 @@ wpa_supplicant_ctrl_iface_init(struct wp
 	}
 
 	os_memset(&addr, 0, sizeof(addr));
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 	addr.sun_len = sizeof(addr);
 #endif /* __FreeBSD__ */
 	addr.sun_family = AF_UNIX;
@@ -645,7 +645,7 @@ wpa_supplicant_global_ctrl_iface_init(st
 	}
 
 	os_memset(&addr, 0, sizeof(addr));
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 	addr.sun_len = sizeof(addr);
 #endif /* __FreeBSD__ */
 	addr.sun_family = AF_UNIX;
---



More information about the Hostap mailing list