From patchwork Thu Aug 17 17:36:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Fortin X-Patchwork-Id: 802802 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=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=cumulusnetworks.com header.i=@cumulusnetworks.com header.b="dQdN8Xg7"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xYD6N1Vs3z9t4X for ; Fri, 18 Aug 2017 03:41:32 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753574AbdHQRla (ORCPT ); Thu, 17 Aug 2017 13:41:30 -0400 Received: from mail-wr0-f176.google.com ([209.85.128.176]:37927 "EHLO mail-wr0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753563AbdHQRl2 (ORCPT ); Thu, 17 Aug 2017 13:41:28 -0400 Received: by mail-wr0-f176.google.com with SMTP id 5so25426378wrz.5 for ; Thu, 17 Aug 2017 10:41:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cumulusnetworks.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1xISWgvm351tE3PR0qkLsIEjTwTntrmwKCJXcJt/piI=; b=dQdN8Xg7KvEOwn2AlM0Xaes0K04IlbV3P0I8HFk2rvZIG5iS9xxbReNlkjlLdU7pIs EzLNGKV/+jfHEn0s+kE9Ux55oyfwOBVidOxkmYVB5bXsrW2GXwAM2N1SqAQ2DwtDt1vP zTEZJDAmcHT0MNfkxaLJvMf88YxdIIehX7Hp0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1xISWgvm351tE3PR0qkLsIEjTwTntrmwKCJXcJt/piI=; b=r4THG3MCGk98kFPTFKR3AheYhocBmJUs9uG28J6yh0MV5ijhGOTF9rlRBdPiV3uZWL /oZaofFmZ0k9rnOBG7guSG27abgcw126WUckZlN9ctr2qv/2mHYPLjhtcLt+QV5sDzUm Pf5qR4MwLWOCFdR7gXoN+EZWR1XJe2r0CYkfQ6thdqqNxHHckOGQJAbCDPjK0gB72FZu fmsESC/onIAD1t50lGs8snbXjaloBgqOlrpi8ImtNOR0DFGUwejP48VMDBY02qJGZcl2 4iYUNQMLk88vbGwooIMO7BbJlQK2efY45OjAzxQlqDJG/UWo0jkrJJ5ESWUIO6oMP1JS vcoA== X-Gm-Message-State: AHYfb5hBBbKsF6yEbd3QPDF+jViUTAzpcpB7lMkm7RuLdKdmxFIiKlAn Cvhe64OpURxL9w5l9Rr/biMi X-Received: by 10.28.98.66 with SMTP id w63mr1967408wmb.34.1502991686852; Thu, 17 Aug 2017 10:41:26 -0700 (PDT) Received: from localhost.localdomain ([37.169.21.172]) by smtp.googlemail.com with ESMTPSA id k13sm3902040wrd.4.2017.08.17.10.41.24 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 17 Aug 2017 10:41:26 -0700 (PDT) From: Julien Fortin X-Google-Original-From: Julien Fortin To: netdev@vger.kernel.org Cc: roopa@cumulusnetworks.com, nikolay@cumulusnetworks.com, dsa@cumulusnetworks.com, Julien Fortin Subject: [PATCH iproute2 json v2 15/27] ip: iplink_ipvlan.c: add json output support Date: Thu, 17 Aug 2017 10:36:02 -0700 Message-Id: <20170817173614.54987-16-julien@cumulusnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170817173614.54987-1-julien@cumulusnetworks.com> References: <20170817173614.54987-1-julien@cumulusnetworks.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Julien Fortin Schema: { "mode": { "type": "string", "attr": "IFLA_IPVLAN_MODE" } } Signed-off-by: Julien Fortin --- ip/iplink_ipvlan.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ip/iplink_ipvlan.c b/ip/iplink_ipvlan.c index f7735f3a..9f48309e 100644 --- a/ip/iplink_ipvlan.c +++ b/ip/iplink_ipvlan.c @@ -68,11 +68,11 @@ static void ipvlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) if (tb[IFLA_IPVLAN_MODE]) { if (RTA_PAYLOAD(tb[IFLA_IPVLAN_MODE]) == sizeof(__u16)) { __u16 mode = rta_getattr_u16(tb[IFLA_IPVLAN_MODE]); - - fprintf(f, " mode %s ", - mode == IPVLAN_MODE_L2 ? "l2" : + const char *mode_str = mode == IPVLAN_MODE_L2 ? "l2" : mode == IPVLAN_MODE_L3 ? "l3" : - mode == IPVLAN_MODE_L3S ? "l3s" : "unknown"); + mode == IPVLAN_MODE_L3S ? "l3s" : "unknown"; + + print_string(PRINT_ANY, "mode", " mode %s ", mode_str); } } }