* [BUG] iproute2 - ip -d -j tuntap outputs malformed JSON
@ 2025-11-21 4:25 Zhengyi Fu
2025-11-22 0:10 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: Zhengyi Fu @ 2025-11-21 4:25 UTC (permalink / raw)
To: netdev
Hi iproute2 maintainers,
$ sudo ip -d -j tuntap
[{"ifname":"tun0","flags":["tun","persist"],"processes":["name":"ssh","pid":86812]}]
The “processes” value looks like it should be an array of objects, so
the inner braces seem to be missing:
[{"ifname":"tun0","flags":["tun","persist"],"processes":[{"name":"ssh","pid":86812}]}]
Could you confirm whether this is a formatting bug or if the output is
intentionally flattened?
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [BUG] iproute2 - ip -d -j tuntap outputs malformed JSON 2025-11-21 4:25 [BUG] iproute2 - ip -d -j tuntap outputs malformed JSON Zhengyi Fu @ 2025-11-22 0:10 ` Stephen Hemminger 2025-11-22 15:49 ` Zhengyi Fu 0 siblings, 1 reply; 3+ messages in thread From: Stephen Hemminger @ 2025-11-22 0:10 UTC (permalink / raw) To: Zhengyi Fu; +Cc: netdev On Fri, 21 Nov 2025 12:25:41 +0800 Zhengyi Fu <i@fuzy.me> wrote: > Hi iproute2 maintainers, > > $ sudo ip -d -j tuntap > [{"ifname":"tun0","flags":["tun","persist"],"processes":["name":"ssh","pid":86812]}] > > The “processes” value looks like it should be an array of objects, so > the inner braces seem to be missing: > > [{"ifname":"tun0","flags":["tun","persist"],"processes":[{"name":"ssh","pid":86812}]}] > > Could you confirm whether this is a formatting bug or if the output is > intentionally flattened? > > Thanks! > It should be an array of objects. You can confirm by seeing the output with multiple processes. Does this fix it? diff --git a/ip/iptuntap.c b/ip/iptuntap.c index b7018a6f..6718ec6c 100644 --- a/ip/iptuntap.c +++ b/ip/iptuntap.c @@ -314,6 +314,7 @@ static void show_processes(const char *name) !strcmp(name, value)) { SPRINT_BUF(pname); + open_json_object(NULL); if (get_task_name(pid, pname, sizeof(pname))) print_string(PRINT_ANY, "name", "%s", "<NULL>"); @@ -322,6 +323,7 @@ static void show_processes(const char *name) "%s", pname); print_uint(PRINT_ANY, "pid", "(%d)", pid); + close_json_object(); } free(key); ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [BUG] iproute2 - ip -d -j tuntap outputs malformed JSON 2025-11-22 0:10 ` Stephen Hemminger @ 2025-11-22 15:49 ` Zhengyi Fu 0 siblings, 0 replies; 3+ messages in thread From: Zhengyi Fu @ 2025-11-22 15:49 UTC (permalink / raw) To: Stephen Hemminger; +Cc: netdev On 2025-11-22 08:10, Stephen Hemminger wrote: > On Fri, 21 Nov 2025 12:25:41 +0800 > Zhengyi Fu <i@fuzy.me> wrote: > >> Hi iproute2 maintainers, >> >> $ sudo ip -d -j tuntap >> >> [{"ifname":"tun0","flags":["tun","persist"],"processes":["name":"ssh","pid":86812]}] >> >> The “processes” value looks like it should be an array of objects, so >> the inner braces seem to be missing: >> >> >> [{"ifname":"tun0","flags":["tun","persist"],"processes":[{"name":"ssh","pid":86812}]}] >> >> Could you confirm whether this is a formatting bug or if the output is >> intentionally flattened? >> >> Thanks! >> > > It should be an array of objects. You can confirm by seeing the output > with multiple processes. > > Does this fix it? > > diff --git a/ip/iptuntap.c b/ip/iptuntap.c > index b7018a6f..6718ec6c 100644 > --- a/ip/iptuntap.c > +++ b/ip/iptuntap.c > @@ -314,6 +314,7 @@ static void show_processes(const char *name) > !strcmp(name, value)) { > SPRINT_BUF(pname); > > + open_json_object(NULL); > if (get_task_name(pid, pname, > sizeof(pname))) > print_string(PRINT_ANY, "name", > "%s", "<NULL>"); > @@ -322,6 +323,7 @@ static void show_processes(const char *name) > "%s", pname); > > print_uint(PRINT_ANY, "pid", "(%d)", > pid); > + close_json_object(); > } > > free(key); Yes, it does. Thanks! ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-23 7:47 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-11-21 4:25 [BUG] iproute2 - ip -d -j tuntap outputs malformed JSON Zhengyi Fu 2025-11-22 0:10 ` Stephen Hemminger 2025-11-22 15:49 ` Zhengyi Fu
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).