All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Zaitceff <zaitceff@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2.6.25.8] ipconfig.c: extend the info in /proc/net/pnp
Date: Sat, 28 Jun 2008 18:41:36 +0600	[thread overview]
Message-ID: <20080628184136.A5610@ward.six> (raw)

This patch extends the info shown thru /proc/net/pnp, making more ipv4
autoconf results accessible to user.  The variables added are:

ic_myaddr
ic_netmask
ic_gateway
root_server_addr
root_server_path
ic_dev_name

This should make diskless clients more happy, as their startup scripts
would have more information.

Please apply the patch, would you consider it useful.


--- net/ipv4/ipconfig.c
+++ net/ipv4/ipconfig.c
@@ -183,6 +183,9 @@
 
 static struct ic_device *ic_first_dev __initdata = NULL;/* List of open device */
 static struct net_device *ic_dev __initdata = NULL;	/* Selected device */
+#ifdef CONFIG_PROC_FS
+static u8 ic_dev_name[sizeof ic_dev->name];
+#endif
 
 static int __init ic_open_devs(void)
 {
@@ -1199,6 +1202,19 @@ static int pnp_seq_show(struct seq_file 
 {
 	int i;
 
+	const struct info {
+		__be32 *value;
+		const char *name;
+	} static list[]= {
+		{&ic_servaddr,"bootserver"},
+		{&ic_myaddr,"myaddr"},
+		{&ic_netmask,"netmask"},
+		{&ic_gateway,"gateway"},
+		{&root_server_addr,"rootserver"},
+		{NULL}
+	};
+	const struct info *p= list;
+
 	if (ic_proto_used & IC_PROTO)
 		seq_printf(seq, "#PROTO: %s\n",
 			   (ic_proto_used & IC_RARP) ? "RARP"
@@ -1215,10 +1231,18 @@ static int pnp_seq_show(struct seq_file 
 				   "nameserver %u.%u.%u.%u\n",
 				   NIPQUAD(ic_nameservers[i]));
 	}
-	if (ic_servaddr != NONE)
-		seq_printf(seq,
-			   "bootserver %u.%u.%u.%u\n",
-			   NIPQUAD(ic_servaddr));
+
+	do if (*p->value != NONE)
+		seq_printf(seq, "%s %u.%u.%u.%u\n",
+			   p->name, NIPQUAD(*p->value));
+	while ((++p)->value);
+
+	if (root_server_path[0])
+		seq_printf(seq, "rootpath %s\n", root_server_path);
+
+	if (ic_dev_name[0])
+		seq_printf(seq, "device %s\n", ic_dev_name);
+
 	return 0;
 }
 
@@ -1386,6 +1410,10 @@ static int __init ip_auto_config(void)
 	ic_proto_used = ic_got_reply | (ic_proto_enabled & IC_USE_DHCP);
 #endif
 
+#ifdef CONFIG_PROC_FS
+        strcpy(ic_dev_name, ic_dev->name);
+#endif
+
 #ifndef IPCONFIG_SILENT
 	/*
 	 * Clue in the operator.

                 reply	other threads:[~2008-06-28 12:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20080628184136.A5610@ward.six \
    --to=zaitceff@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.