[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <63b6585719b0307d81191bbcf5228b94f81c112f.1669930736.git.cdleonard@gmail.com>
Date: Thu, 1 Dec 2022 23:41:05 +0200
From: Leonard Crestez <cdleonard@...il.com>
To: Stephen Hemminger <stephen@...workplumber.org>,
David Ahern <dsahern@...nel.org>
Cc: netdev@...r.kernel.org
Subject: [PATCH iproute2 1/2] 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 <cdleonard@...il.com>
---
ip/ipneigh.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/ip/ipneigh.c b/ip/ipneigh.c
index 61b0a4a22cbf..0cf7bb60553a 100644
--- a/ip/ipneigh.c
+++ b/ip/ipneigh.c
@@ -727,16 +727,19 @@ static int ipneigh_get(int argc, char **argv)
if (rtnl_talk(&rth, &req.n, &answer) < 0)
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;
}
int do_ipneigh(int argc, char **argv)
--
2.34.1
Powered by blists - more mailing lists