netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 2/8] ipconfig: Tidy up reporting of name servers
Date: Sat,  7 Apr 2018 05:08:57 +0100	[thread overview]
Message-ID: <20180407040903.8997-3-chris@chrisn.me.uk> (raw)
In-Reply-To: <20180407040903.8997-1-chris@chrisn.me.uk>

Commit 5e953778a2aab04929a5e7b69f53dc26e39b079e ("ipconfig: add
nameserver IPs to kernel-parameter ip=") adds the IP addresses of
discovered name servers to the summary printed by ipconfig when
configuration is complete. It appears the intention in ip_auto_config()
was to print the name servers on a new line (especially given the
spacing and lack of comma before "nameserver0="), but they're actually
printed on the same line as the NFS root filesystem configuration
summary:

  [    0.686186] IP-Config: Complete:
  [    0.686226]      device=eth0, hwaddr=xx:xx:xx:xx:xx:xx, ipaddr=10.0.0.2, mask=255.255.255.0, gw=10.0.0.1
  [    0.686328]      host=test, domain=example.com, nis-domain=(none)
  [    0.686386]      bootserver=10.0.0.1, rootserver=10.0.0.1, rootpath=     nameserver0=10.0.0.1

This makes it harder to read and parse ipconfig's output. Instead, print
the name servers on a separate line:

  [    0.791250] IP-Config: Complete:
  [    0.791289]      device=eth0, hwaddr=xx:xx:xx:xx:xx:xx, ipaddr=10.0.0.2, mask=255.255.255.0, gw=10.0.0.1
  [    0.791407]      host=test, domain=example.com, nis-domain=(none)
  [    0.791475]      bootserver=10.0.0.1, rootserver=10.0.0.1, rootpath=
  [    0.791476]      nameserver0=10.0.0.1

Signed-off-by: Chris Novakovic <chris@chrisn.me.uk>
---
 net/ipv4/ipconfig.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 43f620feb1c4..d0ea0ecc9008 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1481,16 +1481,19 @@ static int __init ip_auto_config(void)
 		&ic_servaddr, &root_server_addr, root_server_path);
 	if (ic_dev_mtu)
 		pr_cont(", mtu=%d", ic_dev_mtu);
-	for (i = 0; i < CONF_NAMESERVERS_MAX; i++)
+	/* Name servers (if any): */
+	for (i = 0; i < CONF_NAMESERVERS_MAX; i++) {
 		if (ic_nameservers[i] != NONE) {
-			pr_cont("     nameserver%u=%pI4",
-				i, &ic_nameservers[i]);
-			break;
+			if (i == 0)
+				pr_info("     nameserver%u=%pI4",
+					i, &ic_nameservers[i]);
+			else
+				pr_cont(", nameserver%u=%pI4",
+					i, &ic_nameservers[i]);
 		}
-	for (i++; i < CONF_NAMESERVERS_MAX; i++)
-		if (ic_nameservers[i] != NONE)
-			pr_cont(", nameserver%u=%pI4", i, &ic_nameservers[i]);
-	pr_cont("\n");
+		if (i + 1 == CONF_NAMESERVERS_MAX)
+			pr_cont("\n");
+	}
 #endif /* !SILENT */
 
 	/*
-- 
2.14.1

  parent reply	other threads:[~2018-04-07  4:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-07  4:08 [PATCH 0/8] ipconfig: NTP server support, bug fixes, documentation improvements Chris Novakovic
2018-04-07  4:08 ` [PATCH 1/8] ipconfig: Document setting of NIS domain name Chris Novakovic
2018-04-07  4:08 ` Chris Novakovic [this message]
2018-04-07  4:08 ` [PATCH 3/8] ipconfig: BOOTP: Don't request IEN-116 name servers Chris Novakovic
2018-04-07  4:08 ` [PATCH 4/8] ipconfig: BOOTP: Request CONF_NAMESERVERS_MAX " Chris Novakovic
2018-04-07  4:09 ` [PATCH 5/8] ipconfig: Document /proc/net/pnp Chris Novakovic
2018-04-07  4:09 ` [PATCH 6/8] ipconfig: Correctly initialise ic_nameservers Chris Novakovic
2018-04-07  4:09 ` [PATCH 7/8] ipconfig: Write NTP server IPs to /proc/net/ntp Chris Novakovic
2018-04-07 15:25   ` Chris Novakovic
2018-04-07 15:28   ` [PATCH v2 " Chris Novakovic
2018-04-07  4:09 ` [PATCH 8/8] CREDITS: Add Chris Novakovic Chris Novakovic
2018-04-07 16:29 ` [PATCH 0/8] ipconfig: NTP server support, bug fixes, documentation improvements David Miller
2018-04-07 17:49   ` Chris Novakovic
  -- strict thread matches above, loose matches on Subject: below --
2018-04-17 20:58 Chris Novakovic
2018-04-17 20:58 ` [PATCH 2/8] ipconfig: Tidy up reporting of name servers Chris Novakovic

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=20180407040903.8997-3-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).