diff options
author | Patrick McHardy <kaber@trash.net> | 2006-03-20 21:03:16 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-20 21:03:16 -0500 |
commit | f2ffd9eeda82b476c034d733be08ecf6a87d2edf (patch) | |
tree | 05cbab3a8eb03184b7c924bb30ae7be0380336ad /include/net | |
parent | c49867347404c46f137a261643ed4fce4376f324 (diff) |
[NETFILTER]: Move ip6_masked_addrcmp to include/net/ipv6.h
Replace netfilter's ip6_masked_addrcmp by a more efficient version
in include/net/ipv6.h to make it usable without module dependencies.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/ipv6.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 3b1d963d396c..c893a1ce4b39 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -282,6 +282,18 @@ static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr | |||
282 | return memcmp((const void *) a1, (const void *) a2, sizeof(struct in6_addr)); | 282 | return memcmp((const void *) a1, (const void *) a2, sizeof(struct in6_addr)); |
283 | } | 283 | } |
284 | 284 | ||
285 | static inline int | ||
286 | ipv6_masked_addr_cmp(const struct in6_addr *a1, const struct in6_addr *m, | ||
287 | const struct in6_addr *a2) | ||
288 | { | ||
289 | unsigned int i; | ||
290 | |||
291 | for (i = 0; i < 4; i++) | ||
292 | if ((a1->s6_addr32[i] ^ a2->s6_addr32[i]) & m->s6_addr32[i]) | ||
293 | return 1; | ||
294 | return 0; | ||
295 | } | ||
296 | |||
285 | static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2) | 297 | static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2) |
286 | { | 298 | { |
287 | memcpy((void *) a1, (const void *) a2, sizeof(struct in6_addr)); | 299 | memcpy((void *) a1, (const void *) a2, sizeof(struct in6_addr)); |