From: Leonard Crestez Date: Thu, 1 Dec 2022 21:41:05 +0000 (+0200) Subject: ip neigh: Support --json on ip neigh get X-Git-Tag: v6.2.0~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94fc813b85dfde340e8725b3da6385a7b81e43f2;p=thirdparty%2Fiproute2.git ip neigh: Support --json on ip neigh get The ip neigh command supports --json for "list" but not for "get". Add json support for the "get" command so that it's possible to fetch information about specific neighbors without regular expressions. Fixes: aac7f725fa46 ("ipneigh: add color and json support") Signed-off-by: Leonard Crestez Signed-off-by: David Ahern --- diff --git a/ip/ipneigh.c b/ip/ipneigh.c index 61b0a4a22..0cf7bb605 100644 --- a/ip/ipneigh.c +++ b/ip/ipneigh.c @@ -729,12 +729,15 @@ static int ipneigh_get(int argc, char **argv) return -2; ipneigh_reset_filter(0); + new_json_obj(json); if (print_neigh(answer, stdout) < 0) { fprintf(stderr, "An error :-)\n"); free(answer); + delete_json_obj(); return -1; } free(answer); + delete_json_obj(); return 0; }