提交 539054a8 编写于 作者: J Jan Engelhardt 提交者: David S. Miller

netfilter: xt_connlimit: fix regression caused by zero family value

Commit v2.6.28-rc1~717^2~109^2~2 was slightly incomplete; not all
instances of par->match->family were changed to par->family.

References: http://bugzilla.netfilter.org/show_bug.cgi?id=610Signed-off-by: NJan Engelhardt <jengelh@medozas.de>
Signed-off-by: NPatrick McHardy <kaber@trash.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 887e671f
...@@ -103,7 +103,7 @@ static int count_them(struct xt_connlimit_data *data, ...@@ -103,7 +103,7 @@ static int count_them(struct xt_connlimit_data *data,
const struct nf_conntrack_tuple *tuple, const struct nf_conntrack_tuple *tuple,
const union nf_inet_addr *addr, const union nf_inet_addr *addr,
const union nf_inet_addr *mask, const union nf_inet_addr *mask,
const struct xt_match *match) u_int8_t family)
{ {
const struct nf_conntrack_tuple_hash *found; const struct nf_conntrack_tuple_hash *found;
struct xt_connlimit_conn *conn; struct xt_connlimit_conn *conn;
...@@ -113,8 +113,7 @@ static int count_them(struct xt_connlimit_data *data, ...@@ -113,8 +113,7 @@ static int count_them(struct xt_connlimit_data *data,
bool addit = true; bool addit = true;
int matches = 0; int matches = 0;
if (family == NFPROTO_IPV6)
if (match->family == NFPROTO_IPV6)
hash = &data->iphash[connlimit_iphash6(addr, mask)]; hash = &data->iphash[connlimit_iphash6(addr, mask)];
else else
hash = &data->iphash[connlimit_iphash(addr->ip & mask->ip)]; hash = &data->iphash[connlimit_iphash(addr->ip & mask->ip)];
...@@ -157,8 +156,7 @@ static int count_them(struct xt_connlimit_data *data, ...@@ -157,8 +156,7 @@ static int count_them(struct xt_connlimit_data *data,
continue; continue;
} }
if (same_source_net(addr, mask, &conn->tuple.src.u3, if (same_source_net(addr, mask, &conn->tuple.src.u3, family))
match->family))
/* same source network -> be counted! */ /* same source network -> be counted! */
++matches; ++matches;
nf_ct_put(found_ct); nf_ct_put(found_ct);
...@@ -207,7 +205,7 @@ connlimit_mt(const struct sk_buff *skb, const struct xt_match_param *par) ...@@ -207,7 +205,7 @@ connlimit_mt(const struct sk_buff *skb, const struct xt_match_param *par)
spin_lock_bh(&info->data->lock); spin_lock_bh(&info->data->lock);
connections = count_them(info->data, tuple_ptr, &addr, connections = count_them(info->data, tuple_ptr, &addr,
&info->mask, par->match); &info->mask, par->family);
spin_unlock_bh(&info->data->lock); spin_unlock_bh(&info->data->lock);
if (connections < 0) { if (connections < 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册