diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-06-01 02:51:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-02 08:16:23 -0400 |
commit | c2d9ba9bce8d7323ca96f239e1f505c14d6244fb (patch) | |
tree | 7a184eefa2e48e6aa15cdf3aefb6ccf2fb834320 /net | |
parent | c6b20d941b08941bece53bc3d857beb1fb25fffc (diff) |
net: CONFIG_NET_NS reduction
Use read_pnet() and write_pnet() to reduce number of ifdef CONFIG_NET_NS
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/addrlabel.c | 6 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_core.c | 8 |
2 files changed, 3 insertions, 11 deletions
diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c index 8c4348cb1950..f0e774cea386 100644 --- a/net/ipv6/addrlabel.c +++ b/net/ipv6/addrlabel.c | |||
@@ -53,11 +53,7 @@ static struct ip6addrlbl_table | |||
53 | static inline | 53 | static inline |
54 | struct net *ip6addrlbl_net(const struct ip6addrlbl_entry *lbl) | 54 | struct net *ip6addrlbl_net(const struct ip6addrlbl_entry *lbl) |
55 | { | 55 | { |
56 | #ifdef CONFIG_NET_NS | 56 | return read_pnet(&lbl->lbl_net); |
57 | return lbl->lbl_net; | ||
58 | #else | ||
59 | return &init_net; | ||
60 | #endif | ||
61 | } | 57 | } |
62 | 58 | ||
63 | /* | 59 | /* |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index eeeb8bc73982..77288980fae0 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -619,9 +619,7 @@ struct nf_conn *nf_conntrack_alloc(struct net *net, u16 zone, | |||
619 | ct->tuplehash[IP_CT_DIR_REPLY].hnnode.pprev = NULL; | 619 | ct->tuplehash[IP_CT_DIR_REPLY].hnnode.pprev = NULL; |
620 | /* Don't set timer yet: wait for confirmation */ | 620 | /* Don't set timer yet: wait for confirmation */ |
621 | setup_timer(&ct->timeout, death_by_timeout, (unsigned long)ct); | 621 | setup_timer(&ct->timeout, death_by_timeout, (unsigned long)ct); |
622 | #ifdef CONFIG_NET_NS | 622 | write_pnet(&ct->ct_net, net); |
623 | ct->ct_net = net; | ||
624 | #endif | ||
625 | #ifdef CONFIG_NF_CONNTRACK_ZONES | 623 | #ifdef CONFIG_NF_CONNTRACK_ZONES |
626 | if (zone) { | 624 | if (zone) { |
627 | struct nf_conntrack_zone *nf_ct_zone; | 625 | struct nf_conntrack_zone *nf_ct_zone; |
@@ -1363,9 +1361,7 @@ static int nf_conntrack_init_init_net(void) | |||
1363 | goto err_extend; | 1361 | goto err_extend; |
1364 | #endif | 1362 | #endif |
1365 | /* Set up fake conntrack: to never be deleted, not in any hashes */ | 1363 | /* Set up fake conntrack: to never be deleted, not in any hashes */ |
1366 | #ifdef CONFIG_NET_NS | 1364 | write_pnet(&nf_conntrack_untracked.ct_net, &init_net); |
1367 | nf_conntrack_untracked.ct_net = &init_net; | ||
1368 | #endif | ||
1369 | atomic_set(&nf_conntrack_untracked.ct_general.use, 1); | 1365 | atomic_set(&nf_conntrack_untracked.ct_general.use, 1); |
1370 | /* - and look it like as a confirmed connection */ | 1366 | /* - and look it like as a confirmed connection */ |
1371 | set_bit(IPS_CONFIRMED_BIT, &nf_conntrack_untracked.status); | 1367 | set_bit(IPS_CONFIRMED_BIT, &nf_conntrack_untracked.status); |