diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2009-03-29 16:46:01 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-29 16:46:01 -0400 |
commit | 424b86a6bc9459a830e1e94e0e908f3ac1716b7e (patch) | |
tree | fc845e4bf6eebca37d2bbf8844d656fd3303527a | |
parent | 13223cb02ccfa375f2d683d08d30db5b72264f1e (diff) |
netfilter: xtables: fix IPv6 dependency in the cluster match
This patch fixes a dependency with IPv6:
ERROR: "__ipv6_addr_type" [net/netfilter/xt_cluster.ko] undefined!
This patch adds a function that checks if the higher bits of the
address is 0xFF to identify a multicast address, instead of adding a
dependency due to __ipv6_addr_type(). I came up with this idea after
Patrick McHardy pointed possible problems with runtime module
dependencies.
Reported-by: Steven Noonan <steven@uplinklabs.net>
Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
Reported-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/netfilter/xt_cluster.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/net/netfilter/xt_cluster.c b/net/netfilter/xt_cluster.c index ad5bd890e4e8..6c4847662b85 100644 --- a/net/netfilter/xt_cluster.c +++ b/net/netfilter/xt_cluster.c | |||
@@ -58,6 +58,13 @@ xt_cluster_hash(const struct nf_conn *ct, | |||
58 | } | 58 | } |
59 | 59 | ||
60 | static inline bool | 60 | static inline bool |
61 | xt_cluster_ipv6_is_multicast(const struct in6_addr *addr) | ||
62 | { | ||
63 | __be32 st = addr->s6_addr32[0]; | ||
64 | return ((st & htonl(0xFF000000)) == htonl(0xFF000000)); | ||
65 | } | ||
66 | |||
67 | static inline bool | ||
61 | xt_cluster_is_multicast_addr(const struct sk_buff *skb, u_int8_t family) | 68 | xt_cluster_is_multicast_addr(const struct sk_buff *skb, u_int8_t family) |
62 | { | 69 | { |
63 | bool is_multicast = false; | 70 | bool is_multicast = false; |
@@ -67,8 +74,8 @@ xt_cluster_is_multicast_addr(const struct sk_buff *skb, u_int8_t family) | |||
67 | is_multicast = ipv4_is_multicast(ip_hdr(skb)->daddr); | 74 | is_multicast = ipv4_is_multicast(ip_hdr(skb)->daddr); |
68 | break; | 75 | break; |
69 | case NFPROTO_IPV6: | 76 | case NFPROTO_IPV6: |
70 | is_multicast = ipv6_addr_type(&ipv6_hdr(skb)->daddr) & | 77 | is_multicast = |
71 | IPV6_ADDR_MULTICAST; | 78 | xt_cluster_ipv6_is_multicast(&ipv6_hdr(skb)->daddr); |
72 | break; | 79 | break; |
73 | default: | 80 | default: |
74 | WARN_ON(1); | 81 | WARN_ON(1); |