Commit 8672d4d1 authored by Jozsef Kadlecsik's avatar Jozsef Kadlecsik Committed by Pablo Neira Ayuso

netfilter: ipset: Move often used IPv6 address masking function to header file

Signed-off-by: default avatarJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 43c56e59
...@@ -41,4 +41,13 @@ do { \ ...@@ -41,4 +41,13 @@ do { \
to = from | ~ip_set_hostmask(cidr); \ to = from | ~ip_set_hostmask(cidr); \
} while (0) } while (0)
static inline void
ip6_netmask(union nf_inet_addr *ip, u8 prefix)
{
ip->ip6[0] &= ip_set_netmask6(prefix)[0];
ip->ip6[1] &= ip_set_netmask6(prefix)[1];
ip->ip6[2] &= ip_set_netmask6(prefix)[2];
ip->ip6[3] &= ip_set_netmask6(prefix)[3];
}
#endif /*_PFXLEN_H */ #endif /*_PFXLEN_H */
...@@ -255,15 +255,6 @@ hash_ip6_data_zero_out(struct hash_ip6_elem *elem) ...@@ -255,15 +255,6 @@ hash_ip6_data_zero_out(struct hash_ip6_elem *elem)
ipv6_addr_set(&elem->ip.in6, 0, 0, 0, 0); ipv6_addr_set(&elem->ip.in6, 0, 0, 0, 0);
} }
static inline void
ip6_netmask(union nf_inet_addr *ip, u8 prefix)
{
ip->ip6[0] &= ip_set_netmask6(prefix)[0];
ip->ip6[1] &= ip_set_netmask6(prefix)[1];
ip->ip6[2] &= ip_set_netmask6(prefix)[2];
ip->ip6[3] &= ip_set_netmask6(prefix)[3];
}
static bool static bool
hash_ip6_data_list(struct sk_buff *skb, const struct hash_ip6_elem *data) hash_ip6_data_list(struct sk_buff *skb, const struct hash_ip6_elem *data)
{ {
......
...@@ -445,15 +445,6 @@ hash_ipportnet6_data_zero_out(struct hash_ipportnet6_elem *elem) ...@@ -445,15 +445,6 @@ hash_ipportnet6_data_zero_out(struct hash_ipportnet6_elem *elem)
elem->proto = 0; elem->proto = 0;
} }
static inline void
ip6_netmask(union nf_inet_addr *ip, u8 prefix)
{
ip->ip6[0] &= ip_set_netmask6(prefix)[0];
ip->ip6[1] &= ip_set_netmask6(prefix)[1];
ip->ip6[2] &= ip_set_netmask6(prefix)[2];
ip->ip6[3] &= ip_set_netmask6(prefix)[3];
}
static inline void static inline void
hash_ipportnet6_data_netmask(struct hash_ipportnet6_elem *elem, u8 cidr) hash_ipportnet6_data_netmask(struct hash_ipportnet6_elem *elem, u8 cidr)
{ {
......
...@@ -342,15 +342,6 @@ hash_net6_data_zero_out(struct hash_net6_elem *elem) ...@@ -342,15 +342,6 @@ hash_net6_data_zero_out(struct hash_net6_elem *elem)
elem->cidr = 0; elem->cidr = 0;
} }
static inline void
ip6_netmask(union nf_inet_addr *ip, u8 prefix)
{
ip->ip6[0] &= ip_set_netmask6(prefix)[0];
ip->ip6[1] &= ip_set_netmask6(prefix)[1];
ip->ip6[2] &= ip_set_netmask6(prefix)[2];
ip->ip6[3] &= ip_set_netmask6(prefix)[3];
}
static inline void static inline void
hash_net6_data_netmask(struct hash_net6_elem *elem, u8 cidr) hash_net6_data_netmask(struct hash_net6_elem *elem, u8 cidr)
{ {
......
...@@ -528,15 +528,6 @@ hash_netiface6_data_zero_out(struct hash_netiface6_elem *elem) ...@@ -528,15 +528,6 @@ hash_netiface6_data_zero_out(struct hash_netiface6_elem *elem)
elem->elem = 0; elem->elem = 0;
} }
static inline void
ip6_netmask(union nf_inet_addr *ip, u8 prefix)
{
ip->ip6[0] &= ip_set_netmask6(prefix)[0];
ip->ip6[1] &= ip_set_netmask6(prefix)[1];
ip->ip6[2] &= ip_set_netmask6(prefix)[2];
ip->ip6[3] &= ip_set_netmask6(prefix)[3];
}
static inline void static inline void
hash_netiface6_data_netmask(struct hash_netiface6_elem *elem, u8 cidr) hash_netiface6_data_netmask(struct hash_netiface6_elem *elem, u8 cidr)
{ {
......
...@@ -406,15 +406,6 @@ hash_netport6_data_zero_out(struct hash_netport6_elem *elem) ...@@ -406,15 +406,6 @@ hash_netport6_data_zero_out(struct hash_netport6_elem *elem)
elem->proto = 0; elem->proto = 0;
} }
static inline void
ip6_netmask(union nf_inet_addr *ip, u8 prefix)
{
ip->ip6[0] &= ip_set_netmask6(prefix)[0];
ip->ip6[1] &= ip_set_netmask6(prefix)[1];
ip->ip6[2] &= ip_set_netmask6(prefix)[2];
ip->ip6[3] &= ip_set_netmask6(prefix)[3];
}
static inline void static inline void
hash_netport6_data_netmask(struct hash_netport6_elem *elem, u8 cidr) hash_netport6_data_netmask(struct hash_netport6_elem *elem, u8 cidr)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment