netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.6.25.8] ipconfig.c: extend the info in /proc/net/pnp
@ 2008-06-28 12:41 Denis Zaitceff
  0 siblings, 0 replies; only message in thread
From: Denis Zaitceff @ 2008-06-28 12:41 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-kernel

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-06-28 12:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-28 12:41 [PATCH 2.6.25.8] ipconfig.c: extend the info in /proc/net/pnp Denis Zaitceff

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).