Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 237527
b: refs/heads/master
c: 44bd4de
h: refs/heads/master
i:
  237525: d46e722
  237523: 276dcf4
  237519: 3d0e3a0
v: v3
  • Loading branch information
Stefan Berger authored and Patrick McHardy committed Feb 11, 2011
1 parent e0cb9ce commit 3a18502
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c16e19c11730199c1df686b160c9c972ad28baf8
refs/heads/master: 44bd4de9c2270b22c3c898310102bc6be9ed2978
13 changes: 10 additions & 3 deletions trunk/net/netfilter/xt_connlimit.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ static int count_them(struct net *net,
const struct nf_conntrack_tuple *tuple,
const union nf_inet_addr *addr,
const union nf_inet_addr *mask,
u_int8_t family)
u_int8_t family,
unsigned int threshold)
{
const struct nf_conntrack_tuple_hash *found;
struct xt_connlimit_conn *conn;
Expand Down Expand Up @@ -151,9 +152,14 @@ static int count_them(struct net *net,
continue;
}

if (same_source_net(addr, mask, &conn->tuple.src.u3, family))
if (same_source_net(addr, mask, &conn->tuple.src.u3, family)) {
/* same source network -> be counted! */
++matches;
if (matches > threshold) {
nf_ct_put(found_ct);
break;
}
}
nf_ct_put(found_ct);
}

Expand Down Expand Up @@ -207,7 +213,8 @@ connlimit_mt(const struct sk_buff *skb, struct xt_action_param *par)

spin_lock_bh(&info->data->lock);
connections = count_them(net, info->data, tuple_ptr, &addr,
&info->mask, par->family);
&info->mask, par->family,
info->limit);
spin_unlock_bh(&info->data->lock);

if (connections < 0)
Expand Down

0 comments on commit 3a18502

Please sign in to comment.