From: Stephen Hemminger Date: Tue, 6 Apr 2021 16:24:20 +0000 (-0700) Subject: erspan: fix JSON output X-Git-Tag: v5.12.0~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06d0bbf1ee083ea875e24622db362e68ec611985;p=thirdparty%2Fiproute2.git erspan: fix JSON output The format for erspan/erspan6 output is not valid JSON, as on version 2 a valueless key was presented. The direction should be value and erspan_dir should be the key. Fixes: 289763626721 ("erspan: add erspan version II support") Cc: u9012063@gmail.com Reported-by: Christian Pössinger Signed-off-by: Christian Pössinger Signed-off-by: Stephen Hemminger --- diff --git a/ip/link_gre.c b/ip/link_gre.c index 0461e5d06..6d4a8be81 100644 --- a/ip/link_gre.c +++ b/ip/link_gre.c @@ -536,10 +536,10 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) if (erspan_dir == 0) print_string(PRINT_ANY, "erspan_dir", - "erspan_dir ingress ", NULL); + "erspan_dir %s ", "ingress"); else print_string(PRINT_ANY, "erspan_dir", - "erspan_dir egress ", NULL); + "erspan_dir %s ", "egress"); } if (tb[IFLA_GRE_ERSPAN_HWID]) { diff --git a/ip/link_gre6.c b/ip/link_gre6.c index 9d270f4b4..f33598af8 100644 --- a/ip/link_gre6.c +++ b/ip/link_gre6.c @@ -594,10 +594,10 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) if (erspan_dir == 0) print_string(PRINT_ANY, "erspan_dir", - "erspan_dir ingress ", NULL); + "erspan_dir %s ", "ingress"); else print_string(PRINT_ANY, "erspan_dir", - "erspan_dir egress ", NULL); + "erspan_dir %s ", "egress"); } if (tb[IFLA_GRE_ERSPAN_HWID]) {