diff options
| -rw-r--r-- | net/netfilter/xt_connlimit.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/net/netfilter/xt_connlimit.c b/net/netfilter/xt_connlimit.c index 680980954395..38f03f75a636 100644 --- a/net/netfilter/xt_connlimit.c +++ b/net/netfilter/xt_connlimit.c | |||
| @@ -103,7 +103,7 @@ static int count_them(struct xt_connlimit_data *data, | |||
| 103 | const struct nf_conntrack_tuple *tuple, | 103 | const struct nf_conntrack_tuple *tuple, |
| 104 | const union nf_inet_addr *addr, | 104 | const union nf_inet_addr *addr, |
| 105 | const union nf_inet_addr *mask, | 105 | const union nf_inet_addr *mask, |
| 106 | const struct xt_match *match) | 106 | u_int8_t family) |
| 107 | { | 107 | { |
| 108 | const struct nf_conntrack_tuple_hash *found; | 108 | const struct nf_conntrack_tuple_hash *found; |
| 109 | struct xt_connlimit_conn *conn; | 109 | struct xt_connlimit_conn *conn; |
| @@ -113,8 +113,7 @@ static int count_them(struct xt_connlimit_data *data, | |||
| 113 | bool addit = true; | 113 | bool addit = true; |
| 114 | int matches = 0; | 114 | int matches = 0; |
| 115 | 115 | ||
| 116 | 116 | if (family == NFPROTO_IPV6) | |
| 117 | if (match->family == NFPROTO_IPV6) | ||
| 118 | hash = &data->iphash[connlimit_iphash6(addr, mask)]; | 117 | hash = &data->iphash[connlimit_iphash6(addr, mask)]; |
| 119 | else | 118 | else |
| 120 | hash = &data->iphash[connlimit_iphash(addr->ip & mask->ip)]; | 119 | hash = &data->iphash[connlimit_iphash(addr->ip & mask->ip)]; |
| @@ -157,8 +156,7 @@ static int count_them(struct xt_connlimit_data *data, | |||
| 157 | continue; | 156 | continue; |
| 158 | } | 157 | } |
| 159 | 158 | ||
| 160 | if (same_source_net(addr, mask, &conn->tuple.src.u3, | 159 | if (same_source_net(addr, mask, &conn->tuple.src.u3, family)) |
| 161 | match->family)) | ||
| 162 | /* same source network -> be counted! */ | 160 | /* same source network -> be counted! */ |
| 163 | ++matches; | 161 | ++matches; |
| 164 | nf_ct_put(found_ct); | 162 | nf_ct_put(found_ct); |
| @@ -207,7 +205,7 @@ connlimit_mt(const struct sk_buff *skb, const struct xt_match_param *par) | |||
| 207 | 205 | ||
| 208 | spin_lock_bh(&info->data->lock); | 206 | spin_lock_bh(&info->data->lock); |
| 209 | connections = count_them(info->data, tuple_ptr, &addr, | 207 | connections = count_them(info->data, tuple_ptr, &addr, |
| 210 | &info->mask, par->match); | 208 | &info->mask, par->family); |
| 211 | spin_unlock_bh(&info->data->lock); | 209 | spin_unlock_bh(&info->data->lock); |
| 212 | 210 | ||
| 213 | if (connections < 0) { | 211 | if (connections < 0) { |
