lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat,  2 Apr 2011 04:53:34 +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 20/24] sysctl: ipv6: register /proc/sys/net/ipv6/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/ipv6/conf/DEVNAME entries.

For now, all interface headers for /proc/sys/net/ipv6/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/ipv6.h |    3 ++-
 net/ipv6/addrconf.c      |   29 ++++++++++++++++++++++++++++-
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 81abfcb..b3c3cd7 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -13,7 +13,8 @@ struct ctl_table_header;
 struct netns_sysctl_ipv6 {
 #ifdef CONFIG_SYSCTL
 	struct ctl_table_header *table;
-	struct ctl_table_header *frags_hdr;
+	struct ctl_table_header *frags_hdr;  /* /proc/sys/net/ipv6/ip6frag_*  */
+	struct ctl_table_header *conf_hdr;   /* /proc/sys/net/ipv6/conf/      */
 #endif
 	int bindv6only;
 	int flush_delay;
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 4a28442..6833fcb 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4556,8 +4556,25 @@ static void addrconf_sysctl_unregister(struct inet6_dev *idev)
 	neigh_sysctl_unregister(idev->nd_parms);
 }
 
+/* empty entry for '/proc/sys/net/ipv6/conf/' */
+static __net_initdata struct ctl_table empty[1];
+static __net_initdata struct ctl_table ipv6_conf_skel[] = {
+	{
+		.procname       = "conf",
+		.mode           = 0555,
+		.child          = empty,
+	},
+	{ },
+};
+
+static __net_initdata const struct ctl_path net_ipv6_path[] = {
+	{ .procname = "net", },
+	{ .procname = "ipv6", },
+	{ },
+};
+
+#endif /* CONFIG_SYSCTL */
 
-#endif
 
 static int __net_init addrconf_init_net(struct net *net)
 {
@@ -4586,6 +4603,12 @@ static int __net_init addrconf_init_net(struct net *net)
 	net->ipv6.devconf_dflt = dflt;
 
 #ifdef CONFIG_SYSCTL
+	err = -ENOMEM;
+	net->ipv6.sysctl.conf_hdr = register_net_sysctl_table(net,
+					net_ipv6_path, ipv6_conf_skel);
+	if (net->ipv6.sysctl.conf_hdr == NULL)
+		goto err_reg_conf;
+
 	err = __addrconf_sysctl_register(net, "all", NULL, all);
 	if (err < 0)
 		goto err_reg_all;
@@ -4593,6 +4616,7 @@ static int __net_init addrconf_init_net(struct net *net)
 	err = __addrconf_sysctl_register(net, "default", NULL, dflt);
 	if (err < 0)
 		goto err_reg_dflt;
+
 #endif
 	return 0;
 
@@ -4600,6 +4624,8 @@ static int __net_init addrconf_init_net(struct net *net)
 err_reg_dflt:
 	__addrconf_sysctl_unregister(all);
 err_reg_all:
+	unregister_net_sysctl_table(net->ipv6.sysctl.conf_hdr);
+err_reg_conf:
 	kfree(dflt);
 #endif
 err_alloc_dflt:
@@ -4613,6 +4639,7 @@ static void __net_exit addrconf_exit_net(struct net *net)
 #ifdef CONFIG_SYSCTL
 	__addrconf_sysctl_unregister(net->ipv6.devconf_dflt);
 	__addrconf_sysctl_unregister(net->ipv6.devconf_all);
+	unregister_net_sysctl_table(net->ipv6.sysctl.conf_hdr);
 #endif
 	if (!net_eq(net, &init_net)) {
 		kfree(net->ipv6.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

Powered by Openwall GNU/*/Linux Powered by OpenVZ