From: Chris Novakovic <chris@chrisn.me.uk>
To: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Cc: Chris Novakovic <chris@chrisn.me.uk>
Subject: [PATCH v2 7/8] ipconfig: Create /proc/net/ipconfig directory
Date: Tue, 24 Apr 2018 03:56:38 +0100 [thread overview]
Message-ID: <20180424025639.2228-8-chris@chrisn.me.uk> (raw)
In-Reply-To: <20180424025639.2228-1-chris@chrisn.me.uk>
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>
---
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
next prev parent reply other threads:[~2018-04-24 2:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-24 2:56 [PATCH v2 0/8] ipconfig: NTP server support, bug fixes, documentation improvements Chris Novakovic
2018-04-24 2:56 ` [PATCH v2 1/8] ipconfig: Document setting of NIS domain name Chris Novakovic
2018-04-24 2:56 ` [PATCH v2 2/8] ipconfig: Tidy up reporting of name servers Chris Novakovic
2018-04-24 2:56 ` [PATCH v2 3/8] ipconfig: BOOTP: Don't request IEN-116 " Chris Novakovic
2018-04-24 2:56 ` [PATCH v2 4/8] ipconfig: BOOTP: Request CONF_NAMESERVERS_MAX " Chris Novakovic
2018-04-24 2:56 ` [PATCH v2 5/8] ipconfig: Document /proc/net/pnp Chris Novakovic
2018-04-24 2:56 ` [PATCH v2 6/8] ipconfig: Correctly initialise ic_nameservers Chris Novakovic
2018-04-24 2:56 ` Chris Novakovic [this message]
2018-04-24 2:56 ` [PATCH v2 8/8] ipconfig: Write NTP server IPs to /proc/net/ipconfig/ntp_servers Chris Novakovic
2018-04-24 17:40 ` [PATCH v2 0/8] ipconfig: NTP server support, bug fixes, documentation improvements David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180424025639.2228-8-chris@chrisn.me.uk \
--to=chris@chrisn.me.uk \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).