Skip to content

Commit

Permalink
ipconfig: Create /proc/net/ipconfig directory
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chris Novakovic authored and David S. Miller committed Apr 24, 2018
1 parent 300eec7 commit 4d019b3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions net/ipv4/ipconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, };

Expand Down Expand Up @@ -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 */

/*
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4d019b3

Please sign in to comment.