diff options
author | Patrick McHardy <kaber@trash.net> | 2008-01-31 07:42:37 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-31 22:28:00 -0500 |
commit | 4d354c5782dc352cec187845d17eedc2c2bfcf67 (patch) | |
tree | 2d20f5d03f14ea36707c651597fcc3161b140926 /net/ipv4 | |
parent | c88130bcd546e73e66165f9c29113dae9facf1ec (diff) |
[NETFILTER]: nf_nat: use RCU for bysource hash
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 | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c index c07575dc702c..c7a985fa30ba 100644 --- a/net/ipv4/netfilter/nf_nat_core.c +++ b/net/ipv4/netfilter/nf_nat_core.c | |||
@@ -154,8 +154,8 @@ find_appropriate_src(const struct nf_conntrack_tuple *tuple, | |||
154 | struct nf_conn *ct; | 154 | struct nf_conn *ct; |
155 | struct hlist_node *n; | 155 | struct hlist_node *n; |
156 | 156 | ||
157 | read_lock_bh(&nf_nat_lock); | 157 | rcu_read_lock(); |
158 | hlist_for_each_entry(nat, n, &bysource[h], bysource) { | 158 | hlist_for_each_entry_rcu(nat, n, &bysource[h], bysource) { |
159 | ct = nat->ct; | 159 | ct = nat->ct; |
160 | if (same_src(ct, tuple)) { | 160 | if (same_src(ct, tuple)) { |
161 | /* Copy source part from reply tuple. */ | 161 | /* Copy source part from reply tuple. */ |
@@ -164,12 +164,12 @@ find_appropriate_src(const struct nf_conntrack_tuple *tuple, | |||
164 | result->dst = tuple->dst; | 164 | result->dst = tuple->dst; |
165 | 165 | ||
166 | if (in_range(result, range)) { | 166 | if (in_range(result, range)) { |
167 | read_unlock_bh(&nf_nat_lock); | 167 | rcu_read_unlock(); |
168 | return 1; | 168 | return 1; |
169 | } | 169 | } |
170 | } | 170 | } |
171 | } | 171 | } |
172 | read_unlock_bh(&nf_nat_lock); | 172 | rcu_read_unlock(); |
173 | return 0; | 173 | return 0; |
174 | } | 174 | } |
175 | 175 | ||
@@ -334,7 +334,7 @@ nf_nat_setup_info(struct nf_conn *ct, | |||
334 | /* nf_conntrack_alter_reply might re-allocate exntension aera */ | 334 | /* nf_conntrack_alter_reply might re-allocate exntension aera */ |
335 | nat = nfct_nat(ct); | 335 | nat = nfct_nat(ct); |
336 | nat->ct = ct; | 336 | nat->ct = ct; |
337 | hlist_add_head(&nat->bysource, &bysource[srchash]); | 337 | hlist_add_head_rcu(&nat->bysource, &bysource[srchash]); |
338 | write_unlock_bh(&nf_nat_lock); | 338 | write_unlock_bh(&nf_nat_lock); |
339 | } | 339 | } |
340 | 340 | ||
@@ -595,7 +595,7 @@ static void nf_nat_cleanup_conntrack(struct nf_conn *ct) | |||
595 | NF_CT_ASSERT(nat->ct->status & IPS_NAT_DONE_MASK); | 595 | NF_CT_ASSERT(nat->ct->status & IPS_NAT_DONE_MASK); |
596 | 596 | ||
597 | write_lock_bh(&nf_nat_lock); | 597 | write_lock_bh(&nf_nat_lock); |
598 | hlist_del(&nat->bysource); | 598 | hlist_del_rcu(&nat->bysource); |
599 | nat->ct = NULL; | 599 | nat->ct = NULL; |
600 | write_unlock_bh(&nf_nat_lock); | 600 | write_unlock_bh(&nf_nat_lock); |
601 | } | 601 | } |