summaryrefslogtreecommitdiff
path: root/net/ipv4/ipconfig.c
diff options
context:
space:
mode:
authorChris Novakovic <chris@chrisn.me.uk>2018-04-24 05:56:38 +0300
committerDavid S. Miller <davem@davemloft.net>2018-04-24 20:40:42 +0300
commit4d019b3f80dc147fd9d177e7e0337fc66e3c0032 (patch)
tree08cfbcc8dbd67a2dda29787c95e7864fcfeb4c38 /net/ipv4/ipconfig.c
parent300eec7c0a2495f771709c7642aa15f7cc148b83 (diff)
downloadlinux-4d019b3f80dc147fd9d177e7e0337fc66e3c0032.tar.xz
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@chrisn.me.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ipconfig.c')
-rw-r--r--net/ipv4/ipconfig.c15
1 files changed, 15 insertions, 0 deletions
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)