diff options
author | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2013-04-08 14:54:37 -0400 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-04-29 14:08:50 -0400 |
commit | 8672d4d1a00b59057bb1f9659259967d2a19e086 (patch) | |
tree | e996591f993f166f60921ba83212288c04e8ab6c | |
parent | 43c56e595bb81319230affd545392536c933317e (diff) |
netfilter: ipset: Move often used IPv6 address masking function to header file
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | include/linux/netfilter/ipset/pfxlen.h | 9 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_ip.c | 9 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_ipportnet.c | 9 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_net.c | 9 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_netiface.c | 9 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_netport.c | 9 |
6 files changed, 9 insertions, 45 deletions
diff --git a/include/linux/netfilter/ipset/pfxlen.h b/include/linux/netfilter/ipset/pfxlen.h index 199fd11fedc0..1afbb94b4b65 100644 --- a/include/linux/netfilter/ipset/pfxlen.h +++ b/include/linux/netfilter/ipset/pfxlen.h | |||
@@ -41,4 +41,13 @@ do { \ | |||
41 | to = from | ~ip_set_hostmask(cidr); \ | 41 | to = from | ~ip_set_hostmask(cidr); \ |
42 | } while (0) | 42 | } while (0) |
43 | 43 | ||
44 | static inline void | ||
45 | ip6_netmask(union nf_inet_addr *ip, u8 prefix) | ||
46 | { | ||
47 | ip->ip6[0] &= ip_set_netmask6(prefix)[0]; | ||
48 | ip->ip6[1] &= ip_set_netmask6(prefix)[1]; | ||
49 | ip->ip6[2] &= ip_set_netmask6(prefix)[2]; | ||
50 | ip->ip6[3] &= ip_set_netmask6(prefix)[3]; | ||
51 | } | ||
52 | |||
44 | #endif /*_PFXLEN_H */ | 53 | #endif /*_PFXLEN_H */ |
diff --git a/net/netfilter/ipset/ip_set_hash_ip.c b/net/netfilter/ipset/ip_set_hash_ip.c index b7d4cb475ae6..c486ad2d43b7 100644 --- a/net/netfilter/ipset/ip_set_hash_ip.c +++ b/net/netfilter/ipset/ip_set_hash_ip.c | |||
@@ -255,15 +255,6 @@ hash_ip6_data_zero_out(struct hash_ip6_elem *elem) | |||
255 | ipv6_addr_set(&elem->ip.in6, 0, 0, 0, 0); | 255 | ipv6_addr_set(&elem->ip.in6, 0, 0, 0, 0); |
256 | } | 256 | } |
257 | 257 | ||
258 | static inline void | ||
259 | ip6_netmask(union nf_inet_addr *ip, u8 prefix) | ||
260 | { | ||
261 | ip->ip6[0] &= ip_set_netmask6(prefix)[0]; | ||
262 | ip->ip6[1] &= ip_set_netmask6(prefix)[1]; | ||
263 | ip->ip6[2] &= ip_set_netmask6(prefix)[2]; | ||
264 | ip->ip6[3] &= ip_set_netmask6(prefix)[3]; | ||
265 | } | ||
266 | |||
267 | static bool | 258 | static bool |
268 | hash_ip6_data_list(struct sk_buff *skb, const struct hash_ip6_elem *data) | 259 | hash_ip6_data_list(struct sk_buff *skb, const struct hash_ip6_elem *data) |
269 | { | 260 | { |
diff --git a/net/netfilter/ipset/ip_set_hash_ipportnet.c b/net/netfilter/ipset/ip_set_hash_ipportnet.c index b4836c81fbb7..352f8b4a63e5 100644 --- a/net/netfilter/ipset/ip_set_hash_ipportnet.c +++ b/net/netfilter/ipset/ip_set_hash_ipportnet.c | |||
@@ -446,15 +446,6 @@ hash_ipportnet6_data_zero_out(struct hash_ipportnet6_elem *elem) | |||
446 | } | 446 | } |
447 | 447 | ||
448 | static inline void | 448 | static inline void |
449 | ip6_netmask(union nf_inet_addr *ip, u8 prefix) | ||
450 | { | ||
451 | ip->ip6[0] &= ip_set_netmask6(prefix)[0]; | ||
452 | ip->ip6[1] &= ip_set_netmask6(prefix)[1]; | ||
453 | ip->ip6[2] &= ip_set_netmask6(prefix)[2]; | ||
454 | ip->ip6[3] &= ip_set_netmask6(prefix)[3]; | ||
455 | } | ||
456 | |||
457 | static inline void | ||
458 | hash_ipportnet6_data_netmask(struct hash_ipportnet6_elem *elem, u8 cidr) | 449 | hash_ipportnet6_data_netmask(struct hash_ipportnet6_elem *elem, u8 cidr) |
459 | { | 450 | { |
460 | ip6_netmask(&elem->ip2, cidr); | 451 | ip6_netmask(&elem->ip2, cidr); |
diff --git a/net/netfilter/ipset/ip_set_hash_net.c b/net/netfilter/ipset/ip_set_hash_net.c index 6dbe0afc5a8d..370947c65b20 100644 --- a/net/netfilter/ipset/ip_set_hash_net.c +++ b/net/netfilter/ipset/ip_set_hash_net.c | |||
@@ -343,15 +343,6 @@ hash_net6_data_zero_out(struct hash_net6_elem *elem) | |||
343 | } | 343 | } |
344 | 344 | ||
345 | static inline void | 345 | static inline void |
346 | ip6_netmask(union nf_inet_addr *ip, u8 prefix) | ||
347 | { | ||
348 | ip->ip6[0] &= ip_set_netmask6(prefix)[0]; | ||
349 | ip->ip6[1] &= ip_set_netmask6(prefix)[1]; | ||
350 | ip->ip6[2] &= ip_set_netmask6(prefix)[2]; | ||
351 | ip->ip6[3] &= ip_set_netmask6(prefix)[3]; | ||
352 | } | ||
353 | |||
354 | static inline void | ||
355 | hash_net6_data_netmask(struct hash_net6_elem *elem, u8 cidr) | 346 | hash_net6_data_netmask(struct hash_net6_elem *elem, u8 cidr) |
356 | { | 347 | { |
357 | ip6_netmask(&elem->ip, cidr); | 348 | ip6_netmask(&elem->ip, cidr); |
diff --git a/net/netfilter/ipset/ip_set_hash_netiface.c b/net/netfilter/ipset/ip_set_hash_netiface.c index 248162020d80..dd9843e3b06c 100644 --- a/net/netfilter/ipset/ip_set_hash_netiface.c +++ b/net/netfilter/ipset/ip_set_hash_netiface.c | |||
@@ -529,15 +529,6 @@ hash_netiface6_data_zero_out(struct hash_netiface6_elem *elem) | |||
529 | } | 529 | } |
530 | 530 | ||
531 | static inline void | 531 | static inline void |
532 | ip6_netmask(union nf_inet_addr *ip, u8 prefix) | ||
533 | { | ||
534 | ip->ip6[0] &= ip_set_netmask6(prefix)[0]; | ||
535 | ip->ip6[1] &= ip_set_netmask6(prefix)[1]; | ||
536 | ip->ip6[2] &= ip_set_netmask6(prefix)[2]; | ||
537 | ip->ip6[3] &= ip_set_netmask6(prefix)[3]; | ||
538 | } | ||
539 | |||
540 | static inline void | ||
541 | hash_netiface6_data_netmask(struct hash_netiface6_elem *elem, u8 cidr) | 532 | hash_netiface6_data_netmask(struct hash_netiface6_elem *elem, u8 cidr) |
542 | { | 533 | { |
543 | ip6_netmask(&elem->ip, cidr); | 534 | ip6_netmask(&elem->ip, cidr); |
diff --git a/net/netfilter/ipset/ip_set_hash_netport.c b/net/netfilter/ipset/ip_set_hash_netport.c index 57b0550a0b0d..cd1d3c1df72a 100644 --- a/net/netfilter/ipset/ip_set_hash_netport.c +++ b/net/netfilter/ipset/ip_set_hash_netport.c | |||
@@ -407,15 +407,6 @@ hash_netport6_data_zero_out(struct hash_netport6_elem *elem) | |||
407 | } | 407 | } |
408 | 408 | ||
409 | static inline void | 409 | static inline void |
410 | ip6_netmask(union nf_inet_addr *ip, u8 prefix) | ||
411 | { | ||
412 | ip->ip6[0] &= ip_set_netmask6(prefix)[0]; | ||
413 | ip->ip6[1] &= ip_set_netmask6(prefix)[1]; | ||
414 | ip->ip6[2] &= ip_set_netmask6(prefix)[2]; | ||
415 | ip->ip6[3] &= ip_set_netmask6(prefix)[3]; | ||
416 | } | ||
417 | |||
418 | static inline void | ||
419 | hash_netport6_data_netmask(struct hash_netport6_elem *elem, u8 cidr) | 410 | hash_netport6_data_netmask(struct hash_netport6_elem *elem, u8 cidr) |
420 | { | 411 | { |
421 | ip6_netmask(&elem->ip, cidr); | 412 | ip6_netmask(&elem->ip, cidr); |