summaryrefslogtreecommitdiffstats
path: root/kernel/ip_set_getport.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2011-02-03 10:27:49 +0100
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2011-02-03 10:27:49 +0100
commit43b0532ea90ae4140233f1e293ff663f7e49bec8 (patch)
tree244bc5cc21c3a87cf4be766a868e7cd51cfca9f1 /kernel/ip_set_getport.c
parenta7586eb0a0eed3554a104ace4fda912c3ab087ab (diff)
netfilter: ipset: fix linking with CONFIG_IPV6=n
Add some #ifdefs to unconditionally return false in ip_set_get_ip6_port() when CONFIG_IPV6=n and convert to ipv6_skip_exthdr() to avoid pulling in the ip6_tables module when loading ipset. Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'kernel/ip_set_getport.c')
-rw-r--r--kernel/ip_set_getport.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/kernel/ip_set_getport.c b/kernel/ip_set_getport.c
index 4dd2785..8d52272 100644
--- a/kernel/ip_set_getport.c
+++ b/kernel/ip_set_getport.c
@@ -13,6 +13,7 @@
#include <linux/icmpv6.h>
#include <linux/netfilter_ipv6/ip6_tables.h>
#include <net/ip.h>
+#include <net/ipv6.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);
+#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
bool
ip_set_get_ip6_port(const struct sk_buff *skb, bool src,
__be16 *port, u8 *proto)
{
- unsigned int protooff = 0;
- int protocol;
- unsigned short fragoff;
+ int protoff;
+ u8 nexthdr;
- protocol = ipv6_find_hdr(skb, &protooff, -1, &fragoff);
- if (protocol <= 0 || fragoff)
+ nexthdr = ipv6_hdr(skb)->nexthdr;
+ protoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr);
+ if (protoff < 0)
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);
+#endif
bool
ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src, __be16 *port)