From: Jouni Malinen Date: Tue, 25 Nov 2014 14:58:21 +0000 (+0200) Subject: proxyarp: Use C library header files and CONFIG_IPV6 X-Git-Tag: hostap_2_4~1029 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=a437378f98c4166928fbbd2cb545dc7a45f6fd3a;p=mech_eap.git proxyarp: Use C library header files and CONFIG_IPV6 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 --- diff --git a/hostapd/Makefile b/hostapd/Makefile index aeea289..74cd9fa 100644 --- a/hostapd/Makefile +++ b/hostapd/Makefile @@ -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 diff --git a/src/ap/dhcp_snoop.c b/src/ap/dhcp_snoop.c index 0b8f92a..703a599 100644 --- a/src/ap/dhcp_snoop.c +++ b/src/ap/dhcp_snoop.c @@ -7,8 +7,8 @@ */ #include "utils/includes.h" -#include -#include +#include +#include #include "utils/common.h" #include "l2_packet/l2_packet.h" diff --git a/src/ap/ndisc_snoop.c b/src/ap/ndisc_snoop.c index b6faeed..b29cc70 100644 --- a/src/ap/ndisc_snoop.c +++ b/src/ap/ndisc_snoop.c @@ -7,8 +7,8 @@ */ #include "utils/includes.h" -#include -#include +#include +#include #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) diff --git a/src/ap/ndisc_snoop.h b/src/ap/ndisc_snoop.h index 9217756..3cc9a55 100644 --- a/src/ap/ndisc_snoop.h +++ b/src/ap/ndisc_snoop.h @@ -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 */