Commit 22c2d8bc authored by Jan Engelhardt's avatar Jan Engelhardt Committed by David S. Miller

[NETFILTER]: xt_connlimit: use the new union nf_inet_addr

Signed-off-by: default avatarJan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e79ec50b
...@@ -4,10 +4,15 @@ ...@@ -4,10 +4,15 @@
struct xt_connlimit_data; struct xt_connlimit_data;
struct xt_connlimit_info { struct xt_connlimit_info {
union {
union nf_inet_addr mask;
#ifndef __KERNEL__
union { union {
__be32 v4_mask; __be32 v4_mask;
__be32 v6_mask[4]; __be32 v6_mask[4];
}; };
#endif
};
unsigned int limit, inverse; unsigned int limit, inverse;
/* this needs to be at the end */ /* this needs to be at the end */
......
...@@ -185,7 +185,7 @@ connlimit_mt(const struct sk_buff *skb, const struct net_device *in, ...@@ -185,7 +185,7 @@ connlimit_mt(const struct sk_buff *skb, const struct net_device *in,
bool *hotdrop) bool *hotdrop)
{ {
const struct xt_connlimit_info *info = matchinfo; const struct xt_connlimit_info *info = matchinfo;
union nf_inet_addr addr, mask; union nf_inet_addr addr;
struct nf_conntrack_tuple tuple; struct nf_conntrack_tuple tuple;
const struct nf_conntrack_tuple *tuple_ptr = &tuple; const struct nf_conntrack_tuple *tuple_ptr = &tuple;
enum ip_conntrack_info ctinfo; enum ip_conntrack_info ctinfo;
...@@ -202,15 +202,14 @@ connlimit_mt(const struct sk_buff *skb, const struct net_device *in, ...@@ -202,15 +202,14 @@ connlimit_mt(const struct sk_buff *skb, const struct net_device *in,
if (match->family == AF_INET6) { if (match->family == AF_INET6) {
const struct ipv6hdr *iph = ipv6_hdr(skb); const struct ipv6hdr *iph = ipv6_hdr(skb);
memcpy(&addr.ip6, &iph->saddr, sizeof(iph->saddr)); memcpy(&addr.ip6, &iph->saddr, sizeof(iph->saddr));
memcpy(&mask.ip6, info->v6_mask, sizeof(info->v6_mask));
} else { } else {
const struct iphdr *iph = ip_hdr(skb); const struct iphdr *iph = ip_hdr(skb);
addr.ip = iph->saddr; addr.ip = iph->saddr;
mask.ip = info->v4_mask;
} }
spin_lock_bh(&info->data->lock); spin_lock_bh(&info->data->lock);
connections = count_them(info->data, tuple_ptr, &addr, &mask, match); connections = count_them(info->data, tuple_ptr, &addr,
&info->mask, match);
spin_unlock_bh(&info->data->lock); spin_unlock_bh(&info->data->lock);
if (connections < 0) { if (connections < 0) {
......
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