[PATCH] bsd: Fix driver_wired.c build

Masashi Honma honma
Thu Jan 7 16:07:09 PST 2010


Hello.

On NetBSD 5.0.1, driver_wired.c build fails with message below.

../src/drivers/driver_wired.c: In function 'wired_init_sockets':
../src/drivers/driver_wired.c:205: error: storage size of 'addr' isn't known
../src/drivers/driver_wired.c:209: error: 'PF_PACKET' undeclared (first use in this function)
../src/drivers/driver_wired.c:209: error: (Each undeclared identifier is reported only once
../src/drivers/driver_wired.c:209: error: for each function it appears in.)
../src/drivers/driver_wired.c:222: error: 'SIOCGIFINDEX' undeclared (first use in this function)
../src/drivers/driver_wired.c:228: error: 'AF_PACKET' undeclared (first use in this function)
../src/drivers/driver_wired.c:229: error: 'struct ifreq' has no member named 'ifr_ifindex'
../src/drivers/driver_wired.c:239: error: 'struct ifreq' has no member named 'ifr_ifindex'
../src/drivers/driver_wired.c:248: error: 'SIOCGIFHWADDR' undeclared (first use in this function)
../src/drivers/driver_wired.c:253: error: 'struct ifreq' has no member named 'ifr_hwaddr'
../src/drivers/driver_wired.c:255: error: 'struct ifreq' has no member named 'ifr_hwaddr'
../src/drivers/driver_wired.c:258: error: 'struct ifreq' has no member named 'ifr_hwaddr'
../src/drivers/driver_wired.c:289: error: 'struct ifreq' has no member named 'ifr_ifrn'
../src/drivers/driver_wired.c:290: error: 'SO_BINDTODEVICE' undeclared (first use in this function)
../src/drivers/driver_wired.c:205: warning: unused variable 'addr'
gmake: *** [../src/drivers/driver_wired.o] Error 1

This patch solves this issue.

diff --git a/src/drivers/driver_wired.c b/src/drivers/driver_wired.c
index 17e6cd3..8f43192 100644
--- a/src/drivers/driver_wired.c
+++ b/src/drivers/driver_wired.c
@@ -112,6 +112,7 @@ static int wired_multicast_membership(int sock, int ifindex,
 }
 
 
+#ifdef __linux__
 static void handle_data(void *ctx, unsigned char *buf, size_t len)
 {
 #ifdef HOSTAPD
@@ -197,10 +198,12 @@ static void handle_dhcp(int sock, void *eloop_ctx, void *sock_ctx)
 	event.new_sta.addr = mac_address;
 	wpa_supplicant_event(eloop_ctx, EVENT_NEW_STA, &event);
 }
+#endif /* __linux__ */
 
 
 static int wired_init_sockets(struct wpa_driver_wired_data *drv, u8 *own_addr)
 {
+#ifdef __linux__
 	struct ifreq ifr;
 	struct sockaddr_ll addr;
 	struct sockaddr_in addr2;
@@ -300,6 +303,9 @@ static int wired_init_sockets(struct wpa_driver_wired_data *drv, u8 *own_addr)
 	}
 
 	return 0;
+#else /* __linux__ */
+	return -1;
+#endif /* __linux__ */
 }
 
 
Regards,
Masashi Honma.



More information about the Hostap mailing list