[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170803155515.99226-16-julien@cumulusnetworks.com>
Date: Thu, 3 Aug 2017 17:55:03 +0200
From: Julien Fortin <julien@...ulusnetworks.com>
To: netdev@...r.kernel.org
Cc: roopa@...ulusnetworks.com, nikolay@...ulusnetworks.com,
dsa@...ulusnetworks.com, Julien Fortin <julien@...ulusnetworks.com>
Subject: [PATCH 15/27] ip: iplink_ipvlan.c: add json output support
From: Julien Fortin <julien@...ulusnetworks.com>
Schema:
{
"mode": {
"type": "string",
"attr": "IFLA_IPVLAN_MODE"
}
}
Signed-off-by: Julien Fortin <julien@...ulusnetworks.com>
---
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);
}
}
}
--
2.13.3
Powered by blists - more mailing lists