[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <b992ffd8be31308937728a05878ead147f20c95e.1301711868.git.lucian.grijincu@gmail.com>
Date: Sat, 2 Apr 2011 04:53:32 +0200
From: Lucian Adrian Grijincu <lucian.grijincu@...il.com>
To: "'David S . Miller'" <davem@...emloft.net>,
Alexey Dobriyan <adobriyan@...il.com>,
"Eric W . Biederman" <ebiederm@...ssion.com>,
Octavian Purdila <tavi@...pub.ro>,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Cc: Lucian Adrian Grijincu <lucian.grijincu@...il.com>
Subject: [PATCH 18/24] sysctl: ipv4: register /proc/sys/net/ipv4/conf empty directory
This does not change any semantics: it just adds a new header that
will be used in the next patch as a parent for all headers for
all /proc/sys/net/ipv4/conf/DEVNAME entries.
For now, all interface headers for /proc/sys/net/ipv4/conf/DEVNAME
will be bound to this header as opposed to another one from above, but
this shouldn't affect performance or behaviour.
Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@...il.com>
---
include/net/netns/ipv4.h | 9 +++++----
net/ipv4/devinet.c | 25 +++++++++++++++++++++++--
2 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 542195d..cdb8307 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -15,10 +15,11 @@ struct sock;
struct netns_ipv4 {
#ifdef CONFIG_SYSCTL
- struct ctl_table_header *forw_hdr;
- struct ctl_table_header *frags_hdr;
- struct ctl_table_header *ipv4_hdr;
- struct ctl_table_header *route_hdr;
+ struct ctl_table_header *forw_hdr; /* /proc/sys/net/ipv4/ip_forward */
+ struct ctl_table_header *conf_hdr; /* /proc/sys/net/ipv4/conf/ */
+ struct ctl_table_header *frags_hdr; /* /proc/sys/net/ipv4/ipfrag_* */
+ struct ctl_table_header *ipv4_hdr; /* see @ipv4_net_table */
+ struct ctl_table_header *route_hdr; /* /proc/sys/net/ipv4/route/flush */
#endif
struct ipv4_devconf *devconf_all;
struct ipv4_devconf *devconf_dflt;
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 551786f..a31cc90 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1698,6 +1698,18 @@ static void devinet_sysctl_unregister(struct in_device *idev)
neigh_sysctl_unregister(idev->arp_parms);
}
+
+/* empty entry for '/proc/sys/net/ipv4/conf/' */
+static __net_initdata struct ctl_table empty[1];
+static __net_initdata struct ctl_table ipv4_conf_skel[] = {
+ {
+ .procname = "conf",
+ .mode = 0555,
+ .child = empty,
+ },
+ { },
+};
+
static struct ctl_table ctl_forward_entry[] = {
{
.procname = "ip_forward",
@@ -1712,7 +1724,7 @@ static struct ctl_table ctl_forward_entry[] = {
{ },
};
-static __net_initdata struct ctl_path net_ipv4_path[] = {
+static __net_initdata const struct ctl_path net_ipv4_path[] = {
{ .procname = "net", },
{ .procname = "ipv4", },
{ },
@@ -1725,7 +1737,7 @@ static __net_init int devinet_init_net(struct net *net)
struct ipv4_devconf *all, *dflt;
#ifdef CONFIG_SYSCTL
struct ctl_table *tbl = ctl_forward_entry;
- struct ctl_table_header *forw_hdr;
+ struct ctl_table_header *forw_hdr, *conf_hdr;
#endif
err = -ENOMEM;
@@ -1753,6 +1765,12 @@ static __net_init int devinet_init_net(struct net *net)
}
#ifdef CONFIG_SYSCTL
+ err = -ENOMEM;
+ conf_hdr = register_net_sysctl_table(net, net_ipv4_path, ipv4_conf_skel);
+ if (conf_hdr == NULL)
+ goto err_reg_conf;
+ net->ipv4.conf_hdr = conf_hdr;
+
err = __devinet_sysctl_register(net, "all", all);
if (err < 0)
goto err_reg_all;
@@ -1778,6 +1796,8 @@ err_reg_ctl:
err_reg_dflt:
__devinet_sysctl_unregister(all);
err_reg_all:
+ unregister_net_sysctl_table(conf_hdr);
+err_reg_conf:
if (tbl != ctl_forward_entry)
kfree(tbl);
err_alloc_ctl:
@@ -1800,6 +1820,7 @@ static __net_exit void devinet_exit_net(struct net *net)
unregister_net_sysctl_table(net->ipv4.forw_hdr);
__devinet_sysctl_unregister(net->ipv4.devconf_dflt);
__devinet_sysctl_unregister(net->ipv4.devconf_all);
+ unregister_net_sysctl_table(net->ipv4.conf_hdr);
kfree(tbl);
#endif
kfree(net->ipv4.devconf_dflt);
--
1.7.5.rc0
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists