From patchwork Tue Aug 8 06:24:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Langrock X-Patchwork-Id: 799038 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xRPW65yVzz9s8w for ; Tue, 8 Aug 2017 16:24:18 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751555AbdHHGYQ (ORCPT ); Tue, 8 Aug 2017 02:24:16 -0400 Received: from a.mx.secunet.com ([62.96.220.36]:59530 "EHLO a.mx.secunet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750776AbdHHGYP (ORCPT ); Tue, 8 Aug 2017 02:24:15 -0400 Received: from localhost (localhost [127.0.0.1]) by a.mx.secunet.com (Postfix) with ESMTP id 57B3620094; Tue, 8 Aug 2017 08:24:14 +0200 (CEST) X-Virus-Scanned: by secunet Received: from a.mx.secunet.com ([127.0.0.1]) by localhost (a.mx.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id K_YacAcJJWjR; Tue, 8 Aug 2017 08:24:13 +0200 (CEST) Received: from mail-essen-01.secunet.de (mail-essen-01.secunet.de [10.53.40.204]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a.mx.secunet.com (Postfix) with ESMTPS id C465F20063; Tue, 8 Aug 2017 08:24:13 +0200 (CEST) Received: from [10.182.7.63] (10.182.7.63) by mail-essen-01.secunet.de (10.53.40.204) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 8 Aug 2017 08:24:12 +0200 From: Christian Langrock Subject: Re: [PATCH] ip/link_vti*.c: Fix output for ikey/okey To: Stephen Hemminger CC: References: <20170807153815.7acf5b93@xeon-e3> Message-ID: Date: Tue, 8 Aug 2017 08:24:12 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170807153815.7acf5b93@xeon-e3> X-EXCLAIMER-MD-CONFIG: 2c86f778-e09b-4440-8b15-867914633a10 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Using hex values sounds reasonable. BR, Christian Updated Patch: Subject: [PATCH] ip/link_vti*.c: Fix output for ikey/okey ikey and okey are normal u32 values. There's no reason to print them as IPv4/IPv6 addresses. Instead print them as hex values. Signed-off-by: Christian Langrock --- ip/link_vti.c | 10 ++++------ ip/link_vti6.c | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) } if (tb[IFLA_VTI_FWMARK] && rta_getattr_u32(tb[IFLA_VTI_FWMARK])) { diff --git a/ip/link_vti.c b/ip/link_vti.c index d5242ac..f87623b 100644 --- a/ip/link_vti.c +++ b/ip/link_vti.c @@ -244,14 +244,12 @@ static void vti_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) fprintf(f, "dev %u ", link); } - if (tb[IFLA_VTI_IKEY]) { - inet_ntop(AF_INET, RTA_DATA(tb[IFLA_VTI_IKEY]), s2, sizeof(s2)); - fprintf(f, "ikey %s ", s2); + if (tb[IFLA_VTI_IKEY] && rta_getattr_u32(tb[IFLA_VTI_IKEY])) { + fprintf(f, "ikey 0x%x ", ntohl(rta_getattr_u32(tb[IFLA_VTI_IKEY]))); } - if (tb[IFLA_VTI_OKEY]) { - inet_ntop(AF_INET, RTA_DATA(tb[IFLA_VTI_OKEY]), s2, sizeof(s2)); - fprintf(f, "okey %s ", s2); + if (tb[IFLA_VTI_OKEY] && rta_getattr_u32(tb[IFLA_VTI_OKEY])) { + fprintf(f, "okey 0x%x ", ntohl(rta_getattr_u32(tb[IFLA_VTI_OKEY]))); } if (tb[IFLA_VTI_FWMARK] && rta_getattr_u32(tb[IFLA_VTI_FWMARK])) { diff --git a/ip/link_vti6.c b/ip/link_vti6.c index 220b7df..6ae87dd 100644 --- a/ip/link_vti6.c +++ b/ip/link_vti6.c @@ -247,14 +247,12 @@ static void vti6_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) fprintf(f, "dev %u ", link); } - if (tb[IFLA_VTI_IKEY]) { - inet_ntop(AF_INET, RTA_DATA(tb[IFLA_VTI_IKEY]), s2, sizeof(s2)); - fprintf(f, "ikey %s ", s2); + if (tb[IFLA_VTI_IKEY] && rta_getattr_u32(tb[IFLA_VTI_IKEY])) { + fprintf(f, "ikey %u ", ntohl(rta_getattr_u32(tb[IFLA_VTI_IKEY]))); } - if (tb[IFLA_VTI_OKEY]) { - inet_ntop(AF_INET, RTA_DATA(tb[IFLA_VTI_OKEY]), s2, sizeof(s2)); - fprintf(f, "okey %s ", s2); + if (tb[IFLA_VTI_OKEY] && rta_getattr_u32(tb[IFLA_VTI_OKEY])) { + fprintf(f, "okey %u ", ntohl(rta_getattr_u32(tb[IFLA_VTI_OKEY])));