From: Pavel Emelyanov <xemul@openvz.org>
To: David Miller <davem@davemloft.net>
Cc: Linux Netdev List <netdev@vger.kernel.org>,
Linux Containers <containers@lists.osdl.org>,
devel@openvz.org
Subject: [PATCH net-2.6.25 6/7] Switch users of ipv4_devconf_dflt to use the pernet one
Date: Tue, 11 Dec 2007 20:59:58 +0300 [thread overview]
Message-ID: <475ED01E.5020505@openvz.org> (raw)
In-Reply-To: <475ECC69.1040809@openvz.org>
They are all collected in the net/ipv4/devinet.c file and
mostly use the IPV4_DEVCONF_DFLT macro.
So I add the net parameter to it and patch users accordingly.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 996f07e..cd957f4 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -83,7 +83,8 @@ static struct ipv4_devconf ipv4_devconf_dflt = {
},
};
-#define IPV4_DEVCONF_DFLT(attr) IPV4_DEVCONF(ipv4_devconf_dflt, attr)
+#define IPV4_DEVCONF_DFLT(net, attr) \
+ IPV4_DEVCONF((*net->ipv4.devconf_dflt), attr)
static const struct nla_policy ifa_ipv4_policy[IFA_MAX+1] = {
[IFA_LOCAL] = { .type = NLA_U32 },
@@ -164,7 +165,8 @@ static struct in_device *inetdev_init(struct net_device *dev)
if (!in_dev)
goto out;
INIT_RCU_HEAD(&in_dev->rcu_head);
- memcpy(&in_dev->cnf, &ipv4_devconf_dflt, sizeof(in_dev->cnf));
+ memcpy(&in_dev->cnf, dev->nd_net->ipv4.devconf_dflt,
+ sizeof(in_dev->cnf));
in_dev->cnf.sysctl = NULL;
in_dev->dev = dev;
if ((in_dev->arp_parms = neigh_parms_alloc(dev, &arp_tbl)) == NULL)
@@ -1248,7 +1250,7 @@ static void devinet_copy_dflt_conf(struct net *net, int i)
rcu_read_lock();
in_dev = __in_dev_get_rcu(dev);
if (in_dev && !test_bit(i, in_dev->cnf.state))
- in_dev->cnf.data[i] = ipv4_devconf_dflt.data[i];
+ in_dev->cnf.data[i] = net->ipv4.devconf_dflt->data[i];
rcu_read_unlock();
}
read_unlock(&dev_base_lock);
@@ -1260,7 +1262,7 @@ static void inet_forward_change(struct net *net)
int on = IPV4_DEVCONF_ALL(FORWARDING);
IPV4_DEVCONF_ALL(ACCEPT_REDIRECTS) = !on;
- IPV4_DEVCONF_DFLT(FORWARDING) = on;
+ IPV4_DEVCONF_DFLT(net, FORWARDING) = on;
read_lock(&dev_base_lock);
for_each_netdev(net, dev) {
@@ -1289,7 +1291,7 @@ static int devinet_conf_proc(ctl_table *ctl, int write,
set_bit(i, cnf->state);
- if (cnf == &ipv4_devconf_dflt)
+ if (cnf == net->ipv4.devconf_dflt)
devinet_copy_dflt_conf(net, i);
}
@@ -1342,7 +1344,7 @@ static int devinet_conf_sysctl(ctl_table *table, int __user *name, int nlen,
set_bit(i, cnf->state);
- if (cnf == &ipv4_devconf_dflt)
+ if (cnf == net->ipv4.devconf_dflt)
devinet_copy_dflt_conf(net, i);
return 1;
@@ -1361,7 +1363,7 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,
if (valp == &IPV4_DEVCONF_ALL(FORWARDING))
inet_forward_change(net);
- else if (valp != &IPV4_DEVCONF_DFLT(FORWARDING))
+ else if (valp != &IPV4_DEVCONF_DFLT(net, FORWARDING))
rt_cache_flush(0);
}
--
1.5.3.4
next prev parent reply other threads:[~2007-12-11 17:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-11 17:44 [PATCH net-2.6.25 0/7] Make ipv4_devconf (all and default) live in net namespaces Pavel Emelyanov
2007-12-11 17:45 ` [PATCH net-2.6.25 1/7] Add the netns_ipv4 struct Pavel Emelyanov
2007-12-16 21:29 ` David Miller
2007-12-11 17:48 ` [PATCH net-2.6.25 2/7] Make __devinet_sysctl_register return an error Pavel Emelyanov
2007-12-16 21:30 ` David Miller
2007-12-11 17:50 ` [PATCH net-2.6.25 3/7] Pass the net pointer to the arp_req_set_proxy() Pavel Emelyanov
[not found] ` <475ECE03.2040402-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-12-16 21:30 ` David Miller
2007-12-11 17:53 ` [PATCH net-2.6.25 4/7] Store the net pointer on devinet's ctl tables Pavel Emelyanov
2007-12-16 21:31 ` David Miller
2007-12-11 17:57 ` [PATCH net-2.6.25 5/7] Move the devinet pointers on the struct net Pavel Emelyanov
2007-12-16 21:31 ` David Miller
2007-12-11 17:59 ` Pavel Emelyanov [this message]
2007-12-16 21:32 ` [PATCH net-2.6.25 6/7] Switch users of ipv4_devconf_dflt to use the pernet one David Miller
2007-12-11 18:02 ` [PATCH net-2.6.25 7/7] Switch users of ipv4_devconf(_all) " Pavel Emelyanov
2007-12-16 21:32 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=475ED01E.5020505@openvz.org \
--to=xemul@openvz.org \
--cc=containers@lists.osdl.org \
--cc=davem@davemloft.net \
--cc=devel@openvz.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.