diff options
author | Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> | 2007-07-08 01:24:04 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-11 01:17:19 -0400 |
commit | e54cbc1f91dea4f98b6209e693d3b5eae46321bd (patch) | |
tree | 4441dfea2c4cef6687fc9664d1b72683f5bc1ef0 /net/ipv4 | |
parent | ceceae1b1555a9afcb8dacf90df5fa1f20fd5466 (diff) |
[NETFILTER]: nf_nat: add reference to conntrack from entry of bysource list
I will split 'struct nf_nat_info' out from conntrack. So I cannot use
'offsetof' to get the pointer to conntrack from it.
Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/netfilter/nf_nat_core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c index ea02f00d2dac..ac7e8abbbdeb 100644 --- a/net/ipv4/netfilter/nf_nat_core.c +++ b/net/ipv4/netfilter/nf_nat_core.c | |||
@@ -97,6 +97,7 @@ static void nf_nat_cleanup_conntrack(struct nf_conn *conn) | |||
97 | nat = nfct_nat(conn); | 97 | nat = nfct_nat(conn); |
98 | write_lock_bh(&nf_nat_lock); | 98 | write_lock_bh(&nf_nat_lock); |
99 | list_del(&nat->info.bysource); | 99 | list_del(&nat->info.bysource); |
100 | nat->info.ct = NULL; | ||
100 | write_unlock_bh(&nf_nat_lock); | 101 | write_unlock_bh(&nf_nat_lock); |
101 | } | 102 | } |
102 | 103 | ||
@@ -169,7 +170,7 @@ find_appropriate_src(const struct nf_conntrack_tuple *tuple, | |||
169 | 170 | ||
170 | read_lock_bh(&nf_nat_lock); | 171 | read_lock_bh(&nf_nat_lock); |
171 | list_for_each_entry(nat, &bysource[h], info.bysource) { | 172 | list_for_each_entry(nat, &bysource[h], info.bysource) { |
172 | ct = (struct nf_conn *)((char *)nat - offsetof(struct nf_conn, data)); | 173 | ct = nat->info.ct; |
173 | if (same_src(ct, tuple)) { | 174 | if (same_src(ct, tuple)) { |
174 | /* Copy source part from reply tuple. */ | 175 | /* Copy source part from reply tuple. */ |
175 | nf_ct_invert_tuplepr(result, | 176 | nf_ct_invert_tuplepr(result, |
@@ -337,6 +338,7 @@ nf_nat_setup_info(struct nf_conn *ct, | |||
337 | 338 | ||
338 | srchash = hash_by_src(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); | 339 | srchash = hash_by_src(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); |
339 | write_lock_bh(&nf_nat_lock); | 340 | write_lock_bh(&nf_nat_lock); |
341 | info->ct = ct; | ||
340 | list_add(&info->bysource, &bysource[srchash]); | 342 | list_add(&info->bysource, &bysource[srchash]); |
341 | write_unlock_bh(&nf_nat_lock); | 343 | write_unlock_bh(&nf_nat_lock); |
342 | } | 344 | } |