[PATCH 1/2] iproute2: treat gre key as number

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: =?UTF-8?q?Timo=20Ter=C3=A4s?=
Date: Wednesday, November 24, 2010 - 1:18 am

Print GRE key as a regular number. It is not really an IPv4 address
and this is also how Cisco and Juniper treats GRE keys. Do keep the
parsing of dotted-quad format for backwards compatibility.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
---
 ip/iptunnel.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/ip/iptunnel.c b/ip/iptunnel.c
index 3525fbb..48faf69 100644
--- a/ip/iptunnel.c
+++ b/ip/iptunnel.c
@@ -306,12 +306,8 @@ static void print_tunnel(struct ip_tunnel_parm *p)
 	struct ip_tunnel_6rd ip6rd;
 	char s1[1024];
 	char s2[1024];
-	char s3[64];
-	char s4[64];
 
 	memset(&ip6rd, 0, sizeof(ip6rd));
-	inet_ntop(AF_INET, &p->i_key, s3, sizeof(s3));
-	inet_ntop(AF_INET, &p->o_key, s4, sizeof(s4));
 
 	/* Do not use format_host() for local addr,
 	 * symbolic name will not be useful.
@@ -377,12 +373,12 @@ static void print_tunnel(struct ip_tunnel_parm *p)
 	}
 
 	if ((p->i_flags&GRE_KEY) && (p->o_flags&GRE_KEY) && p->o_key == p->i_key)
-		printf(" key %s", s3);
+		printf(" key %u", ntohl(p->i_key));
 	else if ((p->i_flags|p->o_flags)&GRE_KEY) {
 		if (p->i_flags&GRE_KEY)
-			printf(" ikey %s ", s3);
+			printf(" ikey %u ", ntohl(p->i_key));
 		if (p->o_flags&GRE_KEY)
-			printf(" okey %s ", s4);
+			printf(" okey %u ", ntohl(p->o_key));
 	}
 
 	if (p->i_flags&GRE_SEQ)
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] iproute2: support xfrm upper protocol gre key, =?UTF-8?q?Timo=20Ter ..., (Tue Nov 23, 8:02 am)
Re: [PATCH] iproute2: support xfrm upper protocol gre key, Stephen Hemminger, (Tue Nov 23, 9:24 am)
Re: [PATCH] iproute2: support xfrm upper protocol gre key, Stephen Hemminger, (Tue Nov 23, 11:13 am)
Re: [PATCH] iproute2: support xfrm upper protocol gre key, Stephen Hemminger, (Tue Nov 23, 11:54 am)
Re: [PATCH] iproute2: support xfrm upper protocol gre key, Ben Hutchings, (Tue Nov 23, 3:26 pm)
[PATCH 1/2] iproute2: treat gre key as number, =?UTF-8?q?Timo=20Ter ..., (Wed Nov 24, 1:18 am)
[PATCH 2/2] iproute2: support xfrm upper protocol gre key, =?UTF-8?q?Timo=20Ter ..., (Wed Nov 24, 1:18 am)
Re: [PATCH 2/2] iproute2: support xfrm upper protocol gre key, Stephen Hemminger, (Tue Nov 30, 10:55 am)