diff options
author | Patrick McHardy <kaber@trash.net> | 2011-02-02 17:50:01 -0500 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2011-02-02 17:50:01 -0500 |
commit | 724bab476bcac9f7d0b5204cb06e346216d42166 (patch) | |
tree | ac4aa027d85a801ca2e3eb75678124434e1ba30d | |
parent | 316ed388802533bcfd3dffb38d2ba29ac5428456 (diff) |
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>
-rw-r--r-- | include/linux/netfilter/ipset/ip_set_getport.h | 10 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_getport.c | 15 |
2 files changed, 19 insertions, 6 deletions
diff --git a/include/linux/netfilter/ipset/ip_set_getport.h b/include/linux/netfilter/ipset/ip_set_getport.h index 694c433298b8..3882a81a3b3c 100644 --- a/include/linux/netfilter/ipset/ip_set_getport.h +++ b/include/linux/netfilter/ipset/ip_set_getport.h | |||
@@ -3,8 +3,18 @@ | |||
3 | 3 | ||
4 | extern bool ip_set_get_ip4_port(const struct sk_buff *skb, bool src, | 4 | extern bool ip_set_get_ip4_port(const struct sk_buff *skb, bool src, |
5 | __be16 *port, u8 *proto); | 5 | __be16 *port, u8 *proto); |
6 | |||
7 | #if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) | ||
6 | extern bool ip_set_get_ip6_port(const struct sk_buff *skb, bool src, | 8 | extern bool ip_set_get_ip6_port(const struct sk_buff *skb, bool src, |
7 | __be16 *port, u8 *proto); | 9 | __be16 *port, u8 *proto); |
10 | #else | ||
11 | static inline bool ip_set_get_ip6_port(const struct sk_buff *skb, bool src, | ||
12 | __be16 *port, u8 *proto) | ||
13 | { | ||
14 | return false; | ||
15 | } | ||
16 | #endif | ||
17 | |||
8 | extern bool ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src, | 18 | extern bool ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src, |
9 | __be16 *port); | 19 | __be16 *port); |
10 | 20 | ||
diff --git a/net/netfilter/ipset/ip_set_getport.c b/net/netfilter/ipset/ip_set_getport.c index 4dd2785a5c72..8d5227212686 100644 --- a/net/netfilter/ipset/ip_set_getport.c +++ b/net/netfilter/ipset/ip_set_getport.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/icmpv6.h> | 13 | #include <linux/icmpv6.h> |
14 | #include <linux/netfilter_ipv6/ip6_tables.h> | 14 | #include <linux/netfilter_ipv6/ip6_tables.h> |
15 | #include <net/ip.h> | 15 | #include <net/ip.h> |
16 | #include <net/ipv6.h> | ||
16 | 17 | ||
17 | #include <linux/netfilter/ipset/ip_set_getport.h> | 18 | #include <linux/netfilter/ipset/ip_set_getport.h> |
18 | 19 | ||
@@ -93,21 +94,23 @@ ip_set_get_ip4_port(const struct sk_buff *skb, bool src, | |||
93 | } | 94 | } |
94 | EXPORT_SYMBOL_GPL(ip_set_get_ip4_port); | 95 | EXPORT_SYMBOL_GPL(ip_set_get_ip4_port); |
95 | 96 | ||
97 | #if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) | ||
96 | bool | 98 | bool |
97 | ip_set_get_ip6_port(const struct sk_buff *skb, bool src, | 99 | ip_set_get_ip6_port(const struct sk_buff *skb, bool src, |
98 | __be16 *port, u8 *proto) | 100 | __be16 *port, u8 *proto) |
99 | { | 101 | { |
100 | unsigned int protooff = 0; | 102 | int protoff; |
101 | int protocol; | 103 | u8 nexthdr; |
102 | unsigned short fragoff; | ||
103 | 104 | ||
104 | protocol = ipv6_find_hdr(skb, &protooff, -1, &fragoff); | 105 | nexthdr = ipv6_hdr(skb)->nexthdr; |
105 | if (protocol <= 0 || fragoff) | 106 | protoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr); |
107 | if (protoff < 0) | ||
106 | return false; | 108 | return false; |
107 | 109 | ||
108 | return get_port(skb, protocol, protooff, src, port, proto); | 110 | return get_port(skb, nexthdr, protoff, src, port, proto); |
109 | } | 111 | } |
110 | EXPORT_SYMBOL_GPL(ip_set_get_ip6_port); | 112 | EXPORT_SYMBOL_GPL(ip_set_get_ip6_port); |
113 | #endif | ||
111 | 114 | ||
112 | bool | 115 | bool |
113 | ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src, __be16 *port) | 116 | ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src, __be16 *port) |