From patchwork Wed Nov 24 08:18:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Timo Teras X-Patchwork-Id: 72811 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A2AC3B70A3 for ; Wed, 24 Nov 2010 19:19:27 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751880Ab0KXITX (ORCPT ); Wed, 24 Nov 2010 03:19:23 -0500 Received: from mail-wy0-f174.google.com ([74.125.82.174]:52240 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751546Ab0KXITW (ORCPT ); Wed, 24 Nov 2010 03:19:22 -0500 Received: by wyb28 with SMTP id 28so9217544wyb.19 for ; Wed, 24 Nov 2010 00:19:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:from:to:cc:subject :date:message-id:x-mailer:in-reply-to:references:mime-version :content-type:content-transfer-encoding; bh=rloN7QmWDtbylJIU+jSocQdVpkWW1U1r+axPQ2g+7JA=; b=te9tuUMOSSYMkE5Y/1+mlwTUgA4XvFG8kBlxCuWbV5sck69IebcSS/ZSE1x0hYsN5D /G+XRVFvQBUo8vVv8Lx0jDMIZkn3a9MkFRS8UNC24yo1LoRcAaI0Js06pbDlox1rKC+e S8yh68X6j9+8aSl9TZ+EDgffmBW5Y8I6RO4Lg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:mime-version:content-type:content-transfer-encoding; b=QFmr4oLwzzA4f22SmvSUgaWl79gPz0KxWdoc6zJ2fxLlcVgLFwWPWkSz32qNZvPeuO RSmKW0mLSwloYNTdtLwDngDxek7Eiu3UyegvijCrMA0Nyu2/KfwpfDQJvYqGK9FN6Ogc zIIBRNvqe+11VRU0HRyAg0/K2JdMOb2EojhQI= Received: by 10.216.180.69 with SMTP id i47mr7779162wem.37.1290586761368; Wed, 24 Nov 2010 00:19:21 -0800 (PST) Received: from vostro.ism.fin.wtbts.net (mail.fi.jw.org [83.145.235.193]) by mx.google.com with ESMTPS id x3sm3305617wes.46.2010.11.24.00.19.20 (version=SSLv3 cipher=RC4-MD5); Wed, 24 Nov 2010 00:19:20 -0800 (PST) From: =?UTF-8?q?Timo=20Ter=C3=A4s?= To: shemminger@linux-foundation.org, netdev@vger.kernel.org Cc: =?UTF-8?q?Timo=20Ter=C3=A4s?= Subject: [PATCH 1/2] iproute2: treat gre key as number Date: Wed, 24 Nov 2010 10:18:57 +0200 Message-Id: <1290586738-27056-1-git-send-email-timo.teras@iki.fi> X-Mailer: git-send-email 1.7.1 In-Reply-To: <20101123105418.65072de8@nehalam> References: <20101123105418.65072de8@nehalam> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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)