diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2010-01-18 02:07:50 -0500 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2010-01-18 02:07:50 -0500 |
commit | 83fc81024bd8572f31db784f8c0079e999a4fa44 (patch) | |
tree | 30fb664bff8f4040ac17a9f44f1753a81478f3f0 | |
parent | 9592a5c01e79dbc59eb56fa26b124e94ffcd0962 (diff) |
netfilter: xt_connlimit: netns support
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r-- | net/netfilter/xt_connlimit.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/netfilter/xt_connlimit.c b/net/netfilter/xt_connlimit.c index 8103bef78e44..0d9d18ea2b09 100644 --- a/net/netfilter/xt_connlimit.c +++ b/net/netfilter/xt_connlimit.c | |||
@@ -90,7 +90,8 @@ same_source_net(const union nf_inet_addr *addr, | |||
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
93 | static int count_them(struct xt_connlimit_data *data, | 93 | static int count_them(struct net *net, |
94 | struct xt_connlimit_data *data, | ||
94 | const struct nf_conntrack_tuple *tuple, | 95 | const struct nf_conntrack_tuple *tuple, |
95 | const union nf_inet_addr *addr, | 96 | const union nf_inet_addr *addr, |
96 | const union nf_inet_addr *mask, | 97 | const union nf_inet_addr *mask, |
@@ -113,7 +114,7 @@ static int count_them(struct xt_connlimit_data *data, | |||
113 | 114 | ||
114 | /* check the saved connections */ | 115 | /* check the saved connections */ |
115 | list_for_each_entry_safe(conn, tmp, hash, list) { | 116 | list_for_each_entry_safe(conn, tmp, hash, list) { |
116 | found = nf_conntrack_find_get(&init_net, &conn->tuple); | 117 | found = nf_conntrack_find_get(net, &conn->tuple); |
117 | found_ct = NULL; | 118 | found_ct = NULL; |
118 | 119 | ||
119 | if (found != NULL) | 120 | if (found != NULL) |
@@ -171,6 +172,7 @@ static int count_them(struct xt_connlimit_data *data, | |||
171 | static bool | 172 | static bool |
172 | connlimit_mt(const struct sk_buff *skb, const struct xt_match_param *par) | 173 | connlimit_mt(const struct sk_buff *skb, const struct xt_match_param *par) |
173 | { | 174 | { |
175 | struct net *net = dev_net(par->in ? par->in : par->out); | ||
174 | const struct xt_connlimit_info *info = par->matchinfo; | 176 | const struct xt_connlimit_info *info = par->matchinfo; |
175 | union nf_inet_addr addr; | 177 | union nf_inet_addr addr; |
176 | struct nf_conntrack_tuple tuple; | 178 | struct nf_conntrack_tuple tuple; |
@@ -195,7 +197,7 @@ connlimit_mt(const struct sk_buff *skb, const struct xt_match_param *par) | |||
195 | } | 197 | } |
196 | 198 | ||
197 | spin_lock_bh(&info->data->lock); | 199 | spin_lock_bh(&info->data->lock); |
198 | connections = count_them(info->data, tuple_ptr, &addr, | 200 | connections = count_them(net, info->data, tuple_ptr, &addr, |
199 | &info->mask, par->family); | 201 | &info->mask, par->family); |
200 | spin_unlock_bh(&info->data->lock); | 202 | spin_unlock_bh(&info->data->lock); |
201 | 203 | ||