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 <j@w1.fi>
This commit is contained in:
parent
a959a3b69d
commit
a437378f98
4 changed files with 12 additions and 10 deletions
|
@ -855,8 +855,10 @@ ifdef CONFIG_PROXYARP
|
||||||
CFLAGS += -DCONFIG_PROXYARP
|
CFLAGS += -DCONFIG_PROXYARP
|
||||||
OBJS += ../src/ap/x_snoop.o
|
OBJS += ../src/ap/x_snoop.o
|
||||||
OBJS += ../src/ap/dhcp_snoop.o
|
OBJS += ../src/ap/dhcp_snoop.o
|
||||||
|
ifdef CONFIG_IPV6
|
||||||
OBJS += ../src/ap/ndisc_snoop.o
|
OBJS += ../src/ap/ndisc_snoop.o
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
OBJS += ../src/drivers/driver_common.o
|
OBJS += ../src/drivers/driver_common.o
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "utils/includes.h"
|
#include "utils/includes.h"
|
||||||
#include <linux/ip.h>
|
#include <netinet/ip.h>
|
||||||
#include <linux/udp.h>
|
#include <netinet/udp.h>
|
||||||
|
|
||||||
#include "utils/common.h"
|
#include "utils/common.h"
|
||||||
#include "l2_packet/l2_packet.h"
|
#include "l2_packet/l2_packet.h"
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "utils/includes.h"
|
#include "utils/includes.h"
|
||||||
#include <linux/ipv6.h>
|
#include <netinet/ip6.h>
|
||||||
#include <linux/icmpv6.h>
|
#include <netinet/icmp6.h>
|
||||||
|
|
||||||
#include "utils/common.h"
|
#include "utils/common.h"
|
||||||
#include "l2_packet/l2_packet.h"
|
#include "l2_packet/l2_packet.h"
|
||||||
|
@ -24,8 +24,8 @@ struct ip6addr {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct icmpv6_ndmsg {
|
struct icmpv6_ndmsg {
|
||||||
struct ipv6hdr ipv6h;
|
struct ip6_hdr ipv6h;
|
||||||
struct icmp6hdr icmp6h;
|
struct icmp6_hdr icmp6h;
|
||||||
struct in6_addr target_addr;
|
struct in6_addr target_addr;
|
||||||
u8 opt_type;
|
u8 opt_type;
|
||||||
u8 len;
|
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)
|
if (msg->opt_type != SOURCE_LL_ADDR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
saddr = &msg->ipv6h.saddr;
|
saddr = &msg->ipv6h.ip6_src;
|
||||||
if (!(saddr->s6_addr32[0] == 0 && saddr->s6_addr32[1] == 0 &&
|
if (!(saddr->s6_addr32[0] == 0 && saddr->s6_addr32[1] == 0 &&
|
||||||
saddr->s6_addr32[2] == 0 && saddr->s6_addr32[3] == 0)) {
|
saddr->s6_addr32[2] == 0 && saddr->s6_addr32[3] == 0)) {
|
||||||
if (len < ETH_HLEN + sizeof(*msg) + ETH_ALEN)
|
if (len < ETH_HLEN + sizeof(*msg) + ETH_ALEN)
|
||||||
|
|
|
@ -9,13 +9,13 @@
|
||||||
#ifndef NDISC_SNOOP_H
|
#ifndef NDISC_SNOOP_H
|
||||||
#define 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);
|
int ndisc_snoop_init(struct hostapd_data *hapd);
|
||||||
void ndisc_snoop_deinit(struct hostapd_data *hapd);
|
void ndisc_snoop_deinit(struct hostapd_data *hapd);
|
||||||
void sta_ip6addr_del(struct hostapd_data *hapd, struct sta_info *sta);
|
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)
|
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 */
|
#endif /* NDISC_SNOOP_H */
|
||||||
|
|
Loading…
Reference in a new issue