From 09bd6e8cca713adc35dac214daa8d71c254a651d Mon Sep 17 00:00:00 2001 From: Kel Modderman Date: Sat, 6 Mar 2010 10:16:47 +0200 Subject: [PATCH] wpa_supplicant: fix FTBFS on Debian GNU/kFreeBSD 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). --- src/drivers/driver_bsd.c | 7 +++++-- src/drivers/driver_wired.c | 8 ++++---- src/l2_packet/l2_packet_freebsd.c | 2 +- src/utils/common.h | 2 +- src/wps/wps_upnp.c | 4 ++-- wpa_supplicant/ctrl_iface_unix.c | 4 ++-- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/drivers/driver_bsd.c b/src/drivers/driver_bsd.c index 83c042223..2ba7c8b98 100644 --- a/src/drivers/driver_bsd.c +++ b/src/drivers/driver_bsd.c @@ -35,11 +35,14 @@ #include #include #else /* __DragonFly__ */ +#ifdef __GLIBC__ +#include +#endif /* __GLIBC__ */ #include #include #include -#endif /* __DragonFly__ */ -#if __FreeBSD__ +#endif /* __DragonFly__ || __GLIBC__ */ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #include #endif #if __NetBSD__ diff --git a/src/drivers/driver_wired.c b/src/drivers/driver_wired.c index 8f43192e4..2b197f0ab 100644 --- a/src/drivers/driver_wired.c +++ b/src/drivers/driver_wired.c @@ -21,9 +21,9 @@ #include #include #endif /* __linux__ */ -#if defined(__FreeBSD__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) #include -#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 char *ifname, const u8 *addr, int add) 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 char *ifname, const u8 *addr, int add) 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; diff --git a/src/l2_packet/l2_packet_freebsd.c b/src/l2_packet/l2_packet_freebsd.c index d1034aa76..009e02c79 100644 --- 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 #endif /* __APPLE__ */ #include diff --git a/src/utils/common.h b/src/utils/common.h index 71cb8d9e3..9abda5920 100644 --- 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 #include #endif /* __linux__ */ diff --git a/src/wps/wps_upnp.c b/src/wps/wps_upnp.c index 877b553bb..f4f209ce5 100644 --- 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 #include #include @@ -884,7 +884,7 @@ int get_netif_info(const char *net_if, unsigned *ip_addr, char **ip_addr_text, 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; diff --git a/wpa_supplicant/ctrl_iface_unix.c b/wpa_supplicant/ctrl_iface_unix.c index 6f78aa542..9b596ba71 100644 --- a/wpa_supplicant/ctrl_iface_unix.c +++ b/wpa_supplicant/ctrl_iface_unix.c @@ -346,7 +346,7 @@ wpa_supplicant_ctrl_iface_init(struct wpa_supplicant *wpa_s) } 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(struct wpa_global *global) } 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;