netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ip: make -resolve addr to print names rather than addresses
@ 2013-09-30 21:01 Sami Kerola
  2013-10-04 18:25 ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Sami Kerola @ 2013-09-30 21:01 UTC (permalink / raw)
  To: netdev; +Cc: kerolasa

As a system admin I occasionally want to be able to check that all
interfaces has a name in DNS or /etc/hosts file.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 ip/ipaddress.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 1c3e4da..d02eaaf 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -636,7 +636,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
 		fprintf(fp, "    family %d ", ifa->ifa_family);
 
 	if (rta_tb[IFA_LOCAL]) {
-		fprintf(fp, "%s", rt_addr_n2a(ifa->ifa_family,
+		fprintf(fp, "%s", format_host(ifa->ifa_family,
 					      RTA_PAYLOAD(rta_tb[IFA_LOCAL]),
 					      RTA_DATA(rta_tb[IFA_LOCAL]),
 					      abuf, sizeof(abuf)));
@@ -647,7 +647,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
 			fprintf(fp, "/%d ", ifa->ifa_prefixlen);
 		} else {
 			fprintf(fp, " peer %s/%d ",
-				rt_addr_n2a(ifa->ifa_family,
+				format_host(ifa->ifa_family,
 					    RTA_PAYLOAD(rta_tb[IFA_ADDRESS]),
 					    RTA_DATA(rta_tb[IFA_ADDRESS]),
 					    abuf, sizeof(abuf)),
@@ -657,14 +657,14 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
 
 	if (rta_tb[IFA_BROADCAST]) {
 		fprintf(fp, "brd %s ",
-			rt_addr_n2a(ifa->ifa_family,
+			format_host(ifa->ifa_family,
 				    RTA_PAYLOAD(rta_tb[IFA_BROADCAST]),
 				    RTA_DATA(rta_tb[IFA_BROADCAST]),
 				    abuf, sizeof(abuf)));
 	}
 	if (rta_tb[IFA_ANYCAST]) {
 		fprintf(fp, "any %s ",
-			rt_addr_n2a(ifa->ifa_family,
+			format_host(ifa->ifa_family,
 				    RTA_PAYLOAD(rta_tb[IFA_ANYCAST]),
 				    RTA_DATA(rta_tb[IFA_ANYCAST]),
 				    abuf, sizeof(abuf)));
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ip: make -resolve addr to print names rather than addresses
  2013-09-30 21:01 [PATCH] ip: make -resolve addr to print names rather than addresses Sami Kerola
@ 2013-10-04 18:25 ` Stephen Hemminger
  2013-10-04 18:49   ` Sami Kerola
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2013-10-04 18:25 UTC (permalink / raw)
  To: Sami Kerola; +Cc: netdev

On Mon, 30 Sep 2013 22:01:48 +0100
Sami Kerola <kerolasa@iki.fi> wrote:

> As a system admin I occasionally want to be able to check that all
> interfaces has a name in DNS or /etc/hosts file.
> 
> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
> ---
>  ip/ipaddress.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/ip/ipaddress.c b/ip/ipaddress.c
> index 1c3e4da..d02eaaf 100644
> --- a/ip/ipaddress.c
> +++ b/ip/ipaddress.c
> @@ -636,7 +636,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
>  		fprintf(fp, "    family %d ", ifa->ifa_family);
>  
>  	if (rta_tb[IFA_LOCAL]) {
> -		fprintf(fp, "%s", rt_addr_n2a(ifa->ifa_family,
> +		fprintf(fp, "%s", format_host(ifa->ifa_family,
>  					      RTA_PAYLOAD(rta_tb[IFA_LOCAL]),
>  					      RTA_DATA(rta_tb[IFA_LOCAL]),
>  					      abuf, sizeof(abuf)));
> @@ -647,7 +647,7 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
>  			fprintf(fp, "/%d ", ifa->ifa_prefixlen);
>  		} else {
>  			fprintf(fp, " peer %s/%d ",
> -				rt_addr_n2a(ifa->ifa_family,
> +				format_host(ifa->ifa_family,
>  					    RTA_PAYLOAD(rta_tb[IFA_ADDRESS]),
>  					    RTA_DATA(rta_tb[IFA_ADDRESS]),
>  					    abuf, sizeof(abuf)),
> @@ -657,14 +657,14 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
>  
>  	if (rta_tb[IFA_BROADCAST]) {
>  		fprintf(fp, "brd %s ",
> -			rt_addr_n2a(ifa->ifa_family,
> +			format_host(ifa->ifa_family,
>  				    RTA_PAYLOAD(rta_tb[IFA_BROADCAST]),
>  				    RTA_DATA(rta_tb[IFA_BROADCAST]),
>  				    abuf, sizeof(abuf)));
>  	}
>  	if (rta_tb[IFA_ANYCAST]) {
>  		fprintf(fp, "any %s ",
> -			rt_addr_n2a(ifa->ifa_family,
> +			format_host(ifa->ifa_family,
>  				    RTA_PAYLOAD(rta_tb[IFA_ANYCAST]),
>  				    RTA_DATA(rta_tb[IFA_ANYCAST]),
>  				    abuf, sizeof(abuf)));

This shouldn't be the default. It will change the result that user's expect now.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ip: make -resolve addr to print names rather than addresses
  2013-10-04 18:25 ` Stephen Hemminger
@ 2013-10-04 18:49   ` Sami Kerola
  0 siblings, 0 replies; 3+ messages in thread
From: Sami Kerola @ 2013-10-04 18:49 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

On 4 October 2013 19:25, Stephen Hemminger <stephen@networkplumber.org> wrote:
> On Mon, 30 Sep 2013 22:01:48 +0100 Sami Kerola <kerolasa@iki.fi> wrote:
>
>> As a system admin I occasionally want to be able to check that all
>> interfaces has a name in DNS or /etc/hosts file.
>
> This shouldn't be the default. It will change the result that user's expect now.

Doesn't the format_host() print exactly the same output as before,
unless -r is defined.
I intended resolution to happen when

ip -r addr

is used, but not when the -r is not specified. Or did I somehow messed
up the logic?

-- 
Sami Kerola
http://www.iki.fi/kerolasa/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-10-04 18:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-30 21:01 [PATCH] ip: make -resolve addr to print names rather than addresses Sami Kerola
2013-10-04 18:25 ` Stephen Hemminger
2013-10-04 18:49   ` Sami Kerola

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