[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180424025639.2228-8-chris@chrisn.me.uk>
Date: Tue, 24 Apr 2018 03:56:38 +0100
From: Chris Novakovic <chris@...isn.me.uk>
To: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Cc: Chris Novakovic <chris@...isn.me.uk>
Subject: [PATCH v2 7/8] ipconfig: Create /proc/net/ipconfig directory
To allow ipconfig to report IP configuration details to user space
processes without cluttering /proc/net, create a new subdirectory
/proc/net/ipconfig. All files containing IP configuration details should
be written to this directory.
Signed-off-by: Chris Novakovic <chris@...isn.me.uk>
---
net/ipv4/ipconfig.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index e11dfd29a929..9abf833f3a99 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -158,6 +158,9 @@ static u8 ic_domain[64]; /* DNS (not NIS) domain name */
* Private state.
*/
+/* proc_dir_entry for /proc/net/ipconfig */
+static struct proc_dir_entry *ipconfig_dir;
+
/* Name of user-selected boot device */
static char user_dev_name[IFNAMSIZ] __initdata = { 0, };
@@ -1301,6 +1304,16 @@ static const struct file_operations pnp_seq_fops = {
.llseek = seq_lseek,
.release = single_release,
};
+
+/* Create the /proc/net/ipconfig directory */
+static int ipconfig_proc_net_init(void)
+{
+ ipconfig_dir = proc_net_mkdir(&init_net, "ipconfig", init_net.proc_net);
+ if (!ipconfig_dir)
+ return -ENOMEM;
+
+ return 0;
+}
#endif /* CONFIG_PROC_FS */
/*
@@ -1384,6 +1397,8 @@ static int __init ip_auto_config(void)
#ifdef CONFIG_PROC_FS
proc_create("pnp", 0444, init_net.proc_net, &pnp_seq_fops);
+
+ ipconfig_proc_net_init();
#endif /* CONFIG_PROC_FS */
if (!ic_enable)
--
2.14.1
Powered by blists - more mailing lists