From patchwork Mon Aug 7 09:59:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Langrock X-Patchwork-Id: 798551 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 3xQtL75yn3z9sNc for ; Mon, 7 Aug 2017 19:59:43 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752703AbdHGJ7k (ORCPT ); Mon, 7 Aug 2017 05:59:40 -0400 Received: from a.mx.secunet.com ([62.96.220.36]:38982 "EHLO a.mx.secunet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752584AbdHGJ7j (ORCPT ); Mon, 7 Aug 2017 05:59:39 -0400 Received: from localhost (localhost [127.0.0.1]) by a.mx.secunet.com (Postfix) with ESMTP id 24FC420189 for ; Mon, 7 Aug 2017 11:59:38 +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 DN5QxhaBwdPn for ; Mon, 7 Aug 2017 11:59:37 +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 A0FA120073 for ; Mon, 7 Aug 2017 11:59:37 +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; Mon, 7 Aug 2017 11:59:37 +0200 To: From: Christian Langrock Subject: [PATCH] ip/link_vti*.c: Fix output for ikey/okey Message-ID: Date: Mon, 7 Aug 2017 11:59:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 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 ikey and okey are normal u32 values. There's no reason to print them as IPv4/IPv6 addresses. Signed-off-by: Christian Langrock --- ip/link_vti.c | 10 ++++------ ip/link_vti6.c | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) + fprintf(f, "okey %u ", 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_vti.c b/ip/link_vti.c index d5242ac..a694ec4 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 %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]))); } 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])) {