summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Novakovic <chris@chrisn.me.uk>2018-04-23 22:56:38 -0400
committerDavid S. Miller <davem@davemloft.net>2018-04-24 13:40:42 -0400
commit4d019b3f80dc147fd9d177e7e0337fc66e3c0032 (patch)
tree08cfbcc8dbd67a2dda29787c95e7864fcfeb4c38
parent300eec7c0a2495f771709c7642aa15f7cc148b83 (diff)
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>
-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 */
158 * Private state. 158 * Private state.
159 */ 159 */
160 160
161/* proc_dir_entry for /proc/net/ipconfig */
162static struct proc_dir_entry *ipconfig_dir;
163
161/* Name of user-selected boot device */ 164/* Name of user-selected boot device */
162static char user_dev_name[IFNAMSIZ] __initdata = { 0, }; 165static char user_dev_name[IFNAMSIZ] __initdata = { 0, };
163 166
@@ -1301,6 +1304,16 @@ static const struct file_operations pnp_seq_fops = {
1301 .llseek = seq_lseek, 1304 .llseek = seq_lseek,
1302 .release = single_release, 1305 .release = single_release,
1303}; 1306};
1307
1308/* Create the /proc/net/ipconfig directory */
1309static int ipconfig_proc_net_init(void)
1310{
1311 ipconfig_dir = proc_net_mkdir(&init_net, "ipconfig", init_net.proc_net);
1312 if (!ipconfig_dir)
1313 return -ENOMEM;
1314
1315 return 0;
1316}
1304#endif /* CONFIG_PROC_FS */ 1317#endif /* CONFIG_PROC_FS */
1305 1318
1306/* 1319/*
@@ -1384,6 +1397,8 @@ static int __init ip_auto_config(void)
1384 1397
1385#ifdef CONFIG_PROC_FS 1398#ifdef CONFIG_PROC_FS
1386 proc_create("pnp", 0444, init_net.proc_net, &pnp_seq_fops); 1399 proc_create("pnp", 0444, init_net.proc_net, &pnp_seq_fops);
1400
1401 ipconfig_proc_net_init();
1387#endif /* CONFIG_PROC_FS */ 1402#endif /* CONFIG_PROC_FS */
1388 1403
1389 if (!ic_enable) 1404 if (!ic_enable)