proxyarp: Use C library header files and CONFIG_IPV6
authorJouni Malinen <j@w1.fi>
Tue, 25 Nov 2014 14:58:21 +0000 (16:58 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 25 Nov 2014 14:58:21 +0000 (16:58 +0200)
This replaces the use of Linux kernel header files (linux/ip.h,
linux/udp.h, linux/ipv6.h, and linux/icmpv6.h) with equivalent header
files from C library. In addition, ndisc_snoop.c is now built
conditionally on CONFIG_IPV6=y so that it is easier to handle hostapd
builds with toolchains that do not support IPv6 even if Hotspot 2.0 is
enabled in the build.

Signed-off-by: Jouni Malinen <j@w1.fi>
hostapd/Makefile
src/ap/dhcp_snoop.c
src/ap/ndisc_snoop.c
src/ap/ndisc_snoop.h

index aeea289..74cd9fa 100644 (file)
@@ -855,8 +855,10 @@ ifdef CONFIG_PROXYARP
 CFLAGS += -DCONFIG_PROXYARP
 OBJS += ../src/ap/x_snoop.o
 OBJS += ../src/ap/dhcp_snoop.o
+ifdef CONFIG_IPV6
 OBJS += ../src/ap/ndisc_snoop.o
 endif
+endif
 
 OBJS += ../src/drivers/driver_common.o
 
index 0b8f92a..703a599 100644 (file)
@@ -7,8 +7,8 @@
  */
 
 #include "utils/includes.h"
-#include <linux/ip.h>
-#include <linux/udp.h>
+#include <netinet/ip.h>
+#include <netinet/udp.h>
 
 #include "utils/common.h"
 #include "l2_packet/l2_packet.h"
index b6faeed..b29cc70 100644 (file)
@@ -7,8 +7,8 @@
  */
 
 #include "utils/includes.h"
-#include <linux/ipv6.h>
-#include <linux/icmpv6.h>
+#include <netinet/ip6.h>
+#include <netinet/icmp6.h>
 
 #include "utils/common.h"
 #include "l2_packet/l2_packet.h"
@@ -24,8 +24,8 @@ struct ip6addr {
 };
 
 struct icmpv6_ndmsg {
-       struct ipv6hdr ipv6h;
-       struct icmp6hdr icmp6h;
+       struct ip6_hdr ipv6h;
+       struct icmp6_hdr icmp6h;
        struct in6_addr target_addr;
        u8 opt_type;
        u8 len;
@@ -98,7 +98,7 @@ static void handle_ndisc(void *ctx, const u8 *src_addr, const u8 *buf,
                if (msg->opt_type != SOURCE_LL_ADDR)
                        return;
 
-               saddr = &msg->ipv6h.saddr;
+               saddr = &msg->ipv6h.ip6_src;
                if (!(saddr->s6_addr32[0] == 0 && saddr->s6_addr32[1] == 0 &&
                      saddr->s6_addr32[2] == 0 && saddr->s6_addr32[3] == 0)) {
                        if (len < ETH_HLEN + sizeof(*msg) + ETH_ALEN)
index 9217756..3cc9a55 100644 (file)
@@ -9,13 +9,13 @@
 #ifndef NDISC_SNOOP_H
 #define NDISC_SNOOP_H
 
-#ifdef CONFIG_PROXYARP
+#if defined(CONFIG_PROXYARP) && defined(CONFIG_IPV6)
 
 int ndisc_snoop_init(struct hostapd_data *hapd);
 void ndisc_snoop_deinit(struct hostapd_data *hapd);
 void sta_ip6addr_del(struct hostapd_data *hapd, struct sta_info *sta);
 
-#else /* CONFIG_PROXYARP */
+#else /* CONFIG_PROXYARP && CONFIG_IPV6 */
 
 static inline int ndisc_snoop_init(struct hostapd_data *hapd)
 {
@@ -31,6 +31,6 @@ static inline void sta_ip6addr_del(struct hostapd_data *hapd,
 {
 }
 
-#endif /* CONFIG_PROXYARP */
+#endif /* CONFIG_PROXYARP && CONFIG_IPV6 */
 
 #endif /* NDISC_SNOOP_H */