mirror of https://gitee.com/openkylin/linux.git
netfilter: ipset: fix linking with CONFIG_IPV6=n
Add a dummy ip_set_get_ip6_port function that unconditionally returns false for CONFIG_IPV6=n and convert the real function to ipv6_skip_exthdr() to avoid pulling in the ip6_tables module when loading ipset. Signed-off-by: Patrick McHardy <kaber@trash.net>
This commit is contained in:
parent
316ed38880
commit
724bab476b
|
@ -3,8 +3,18 @@
|
||||||
|
|
||||||
extern bool ip_set_get_ip4_port(const struct sk_buff *skb, bool src,
|
extern bool ip_set_get_ip4_port(const struct sk_buff *skb, bool src,
|
||||||
__be16 *port, u8 *proto);
|
__be16 *port, u8 *proto);
|
||||||
|
|
||||||
|
#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
|
||||||
extern bool ip_set_get_ip6_port(const struct sk_buff *skb, bool src,
|
extern bool ip_set_get_ip6_port(const struct sk_buff *skb, bool src,
|
||||||
__be16 *port, u8 *proto);
|
__be16 *port, u8 *proto);
|
||||||
|
#else
|
||||||
|
static inline bool ip_set_get_ip6_port(const struct sk_buff *skb, bool src,
|
||||||
|
__be16 *port, u8 *proto)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
extern bool ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src,
|
extern bool ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src,
|
||||||
__be16 *port);
|
__be16 *port);
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <linux/icmpv6.h>
|
#include <linux/icmpv6.h>
|
||||||
#include <linux/netfilter_ipv6/ip6_tables.h>
|
#include <linux/netfilter_ipv6/ip6_tables.h>
|
||||||
#include <net/ip.h>
|
#include <net/ip.h>
|
||||||
|
#include <net/ipv6.h>
|
||||||
|
|
||||||
#include <linux/netfilter/ipset/ip_set_getport.h>
|
#include <linux/netfilter/ipset/ip_set_getport.h>
|
||||||
|
|
||||||
|
@ -93,21 +94,23 @@ ip_set_get_ip4_port(const struct sk_buff *skb, bool src,
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(ip_set_get_ip4_port);
|
EXPORT_SYMBOL_GPL(ip_set_get_ip4_port);
|
||||||
|
|
||||||
|
#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
|
||||||
bool
|
bool
|
||||||
ip_set_get_ip6_port(const struct sk_buff *skb, bool src,
|
ip_set_get_ip6_port(const struct sk_buff *skb, bool src,
|
||||||
__be16 *port, u8 *proto)
|
__be16 *port, u8 *proto)
|
||||||
{
|
{
|
||||||
unsigned int protooff = 0;
|
int protoff;
|
||||||
int protocol;
|
u8 nexthdr;
|
||||||
unsigned short fragoff;
|
|
||||||
|
|
||||||
protocol = ipv6_find_hdr(skb, &protooff, -1, &fragoff);
|
nexthdr = ipv6_hdr(skb)->nexthdr;
|
||||||
if (protocol <= 0 || fragoff)
|
protoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr);
|
||||||
|
if (protoff < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return get_port(skb, protocol, protooff, src, port, proto);
|
return get_port(skb, nexthdr, protoff, src, port, proto);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(ip_set_get_ip6_port);
|
EXPORT_SYMBOL_GPL(ip_set_get_ip6_port);
|
||||||
|
#endif
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src, __be16 *port)
|
ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src, __be16 *port)
|
||||||
|
|
Loading…
Reference in New Issue