* [PATCH iproute2 1/2] ip neigh: Support --json on ip neigh get
@ 2022-12-01 21:41 Leonard Crestez
2022-12-01 21:41 ` [PATCH iproute2 2/2] testsuite: Add test for ip --json " Leonard Crestez
2022-12-02 16:00 ` [PATCH iproute2 1/2] ip neigh: Support --json on ip " patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Leonard Crestez @ 2022-12-01 21:41 UTC (permalink / raw)
To: Stephen Hemminger, David Ahern; +Cc: netdev
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@gmail.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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH iproute2 2/2] testsuite: Add test for ip --json neigh get
2022-12-01 21:41 [PATCH iproute2 1/2] ip neigh: Support --json on ip neigh get Leonard Crestez
@ 2022-12-01 21:41 ` Leonard Crestez
2022-12-02 16:00 ` [PATCH iproute2 1/2] ip neigh: Support --json on ip " patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Leonard Crestez @ 2022-12-01 21:41 UTC (permalink / raw)
To: Stephen Hemminger, David Ahern; +Cc: netdev
Signed-off-by: Leonard Crestez <cdleonard@gmail.com>
---
testsuite/tests/ip/neigh/basic.t | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100755 testsuite/tests/ip/neigh/basic.t
diff --git a/testsuite/tests/ip/neigh/basic.t b/testsuite/tests/ip/neigh/basic.t
new file mode 100755
index 000000000000..9c13c8ef4b25
--- /dev/null
+++ b/testsuite/tests/ip/neigh/basic.t
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+. lib/generic.sh
+
+ts_log "[Testing add/get neigh]"
+
+NEW_DEV="$(rand_dev)"
+ts_ip "$0" "Add $NEW_DEV dummy interface" link add dev $NEW_DEV type dummy
+ts_ip "$0" "Add $NEW_DEV neighbor 192.0.2.2 " neigh add 192.0.2.2 lladdr 02:00:00:00:00:01 dev $NEW_DEV
+ts_ip "$0" "List neighbors " neigh list
+test_on '02:00:00:00:00:01'
+ts_ip "$0" "Get $NEW_DEV neighbor 192.0.2.2 " --json neigh get 192.0.2.2 dev $NEW_DEV
+test_on '"lladdr":"02:00:00:00:00:01"'
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH iproute2 1/2] ip neigh: Support --json on ip neigh get
2022-12-01 21:41 [PATCH iproute2 1/2] ip neigh: Support --json on ip neigh get Leonard Crestez
2022-12-01 21:41 ` [PATCH iproute2 2/2] testsuite: Add test for ip --json " Leonard Crestez
@ 2022-12-02 16:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-12-02 16:00 UTC (permalink / raw)
To: Leonard Crestez; +Cc: stephen, dsahern, netdev
Hello:
This series was applied to iproute2/iproute2-next.git (main)
by David Ahern <dsahern@kernel.org>:
On Thu, 1 Dec 2022 23:41:05 +0200 you wrote:
> 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@gmail.com>
>
> [...]
Here is the summary with links:
- [iproute2,1/2] ip neigh: Support --json on ip neigh get
(no matching commit)
- [iproute2,2/2] testsuite: Add test for ip --json neigh get
https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=acea9032e92e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-02 16:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-01 21:41 [PATCH iproute2 1/2] ip neigh: Support --json on ip neigh get Leonard Crestez
2022-12-01 21:41 ` [PATCH iproute2 2/2] testsuite: Add test for ip --json " Leonard Crestez
2022-12-02 16:00 ` [PATCH iproute2 1/2] ip neigh: Support --json on ip " patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).