diff options
author | Hans Schillstrom <hans.schillstrom@ericsson.com> | 2011-01-03 08:44:57 -0500 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2011-01-12 20:30:28 -0500 |
commit | 6e67e586e7289c144d5a189d6e0fa7141d025746 (patch) | |
tree | 33a064ac5fa2e2ac4270c6361d5566bc99c671e6 /net/netfilter/ipvs/ip_vs_nfct.c | |
parent | b17fc9963f837ef1acfe36e193108fb16ed58647 (diff) |
IPVS: netns, connection hash got net as param.
Connection hash table is now name space aware.
i.e. net ptr >> 8 is xor:ed to the hash,
and this is the first param to be compared.
The net struct is 0xa40 in size ( a little bit smaller for 32 bit arch:s)
and cache-line aligned, so a ptr >> 5 might be a more clever solution ?
All lookups where net is compared uses net_eq() which returns 1 when netns
is disabled, and the compiler seems to do something clever in that case.
ip_vs_conn_fill_param() have *net as first param now.
Three new inlines added to keep conn struct smaller
when names space is disabled.
- ip_vs_conn_net()
- ip_vs_conn_net_set()
- ip_vs_conn_net_eq()
*v3
moved net compare to the end in "fast path"
Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'net/netfilter/ipvs/ip_vs_nfct.c')
-rw-r--r-- | net/netfilter/ipvs/ip_vs_nfct.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/netfilter/ipvs/ip_vs_nfct.c b/net/netfilter/ipvs/ip_vs_nfct.c index 4680647cd45..f454c80df0a 100644 --- a/net/netfilter/ipvs/ip_vs_nfct.c +++ b/net/netfilter/ipvs/ip_vs_nfct.c | |||
@@ -141,6 +141,7 @@ static void ip_vs_nfct_expect_callback(struct nf_conn *ct, | |||
141 | struct nf_conntrack_tuple *orig, new_reply; | 141 | struct nf_conntrack_tuple *orig, new_reply; |
142 | struct ip_vs_conn *cp; | 142 | struct ip_vs_conn *cp; |
143 | struct ip_vs_conn_param p; | 143 | struct ip_vs_conn_param p; |
144 | struct net *net = nf_ct_net(ct); | ||
144 | 145 | ||
145 | if (exp->tuple.src.l3num != PF_INET) | 146 | if (exp->tuple.src.l3num != PF_INET) |
146 | return; | 147 | return; |
@@ -155,7 +156,7 @@ static void ip_vs_nfct_expect_callback(struct nf_conn *ct, | |||
155 | 156 | ||
156 | /* RS->CLIENT */ | 157 | /* RS->CLIENT */ |
157 | orig = &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple; | 158 | orig = &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple; |
158 | ip_vs_conn_fill_param(exp->tuple.src.l3num, orig->dst.protonum, | 159 | ip_vs_conn_fill_param(net, exp->tuple.src.l3num, orig->dst.protonum, |
159 | &orig->src.u3, orig->src.u.tcp.port, | 160 | &orig->src.u3, orig->src.u.tcp.port, |
160 | &orig->dst.u3, orig->dst.u.tcp.port, &p); | 161 | &orig->dst.u3, orig->dst.u.tcp.port, &p); |
161 | cp = ip_vs_conn_out_get(&p); | 162 | cp = ip_vs_conn_out_get(&p); |
@@ -268,7 +269,8 @@ void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp) | |||
268 | " for conn " FMT_CONN "\n", | 269 | " for conn " FMT_CONN "\n", |
269 | __func__, ARG_TUPLE(&tuple), ARG_CONN(cp)); | 270 | __func__, ARG_TUPLE(&tuple), ARG_CONN(cp)); |
270 | 271 | ||
271 | h = nf_conntrack_find_get(&init_net, NF_CT_DEFAULT_ZONE, &tuple); | 272 | h = nf_conntrack_find_get(ip_vs_conn_net(cp), NF_CT_DEFAULT_ZONE, |
273 | &tuple); | ||
272 | if (h) { | 274 | if (h) { |
273 | ct = nf_ct_tuplehash_to_ctrack(h); | 275 | ct = nf_ct_tuplehash_to_ctrack(h); |
274 | /* Show what happens instead of calling nf_ct_kill() */ | 276 | /* Show what happens instead of calling nf_ct_kill() */ |