* [PATCH iproute2] bridge: mdb: restore text output format
@ 2019-05-29 17:52 Nikolay Aleksandrov
2019-05-30 18:06 ` Stephen Hemminger
0 siblings, 1 reply; 2+ messages in thread
From: Nikolay Aleksandrov @ 2019-05-29 17:52 UTC (permalink / raw)
To: netdev; +Cc: roopa, stephen, Nikolay Aleksandrov
While I fixed the mdb json output, I did overlook the text output.
This patch returns the original text output format:
dev <bridge> port <port> grp <mcast group> <temp|permanent> <flags> <timer>
Example (old format, restored by this patch):
dev br0 port eth8 grp 239.1.1.11 temp
Example (changed format after the commit below):
23: br0 eth8 239.1.1.11 temp
We had some reports of failing scripts which were parsing the output.
Also the old format matches the bridge mdb command syntax which makes
it easier to build commands out of the output.
Fixes: c7c1a1ef51ae ("bridge: colorize output and use JSON print library")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
I know text output isn't considered API, but there are scripts out there
which rely on the format or at least on the old strings/values to be
present.
bridge/mdb.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/bridge/mdb.c b/bridge/mdb.c
index 59aa17643517..eadc6212af70 100644
--- a/bridge/mdb.c
+++ b/bridge/mdb.c
@@ -132,21 +132,21 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e,
open_json_object(NULL);
- print_int(PRINT_ANY, "index", "%u: ", ifindex);
- print_color_string(PRINT_ANY, COLOR_IFNAME, "dev", "%s ", dev);
- print_string(PRINT_ANY, "port", " %s ",
+ print_int(PRINT_JSON, "index", NULL, ifindex);
+ print_color_string(PRINT_ANY, COLOR_IFNAME, "dev", "dev %s", dev);
+ print_string(PRINT_ANY, "port", " port %s",
ll_index_to_name(e->ifindex));
print_color_string(PRINT_ANY, ifa_family_color(af),
- "grp", " %s ",
+ "grp", " grp %s",
inet_ntop(af, src, abuf, sizeof(abuf)));
- print_string(PRINT_ANY, "state", " %s ",
+ print_string(PRINT_ANY, "state", " %s",
(e->state & MDB_PERMANENT) ? "permanent" : "temp");
open_json_array(PRINT_JSON, "flags");
if (e->flags & MDB_FLAGS_OFFLOAD)
- print_string(PRINT_ANY, NULL, "%s ", "offload");
+ print_string(PRINT_ANY, NULL, " %s", "offload");
close_json_array(PRINT_JSON, NULL);
if (e->vid)
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH iproute2] bridge: mdb: restore text output format
2019-05-29 17:52 [PATCH iproute2] bridge: mdb: restore text output format Nikolay Aleksandrov
@ 2019-05-30 18:06 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2019-05-30 18:06 UTC (permalink / raw)
To: Nikolay Aleksandrov; +Cc: netdev, roopa
On Wed, 29 May 2019 20:52:42 +0300
Nikolay Aleksandrov <nikolay@cumulusnetworks.com> wrote:
> While I fixed the mdb json output, I did overlook the text output.
> This patch returns the original text output format:
> dev <bridge> port <port> grp <mcast group> <temp|permanent> <flags> <timer>
> Example (old format, restored by this patch):
> dev br0 port eth8 grp 239.1.1.11 temp
>
> Example (changed format after the commit below):
> 23: br0 eth8 239.1.1.11 temp
>
> We had some reports of failing scripts which were parsing the output.
> Also the old format matches the bridge mdb command syntax which makes
> it easier to build commands out of the output.
>
> Fixes: c7c1a1ef51ae ("bridge: colorize output and use JSON print library")
> Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Looks good, thanks for fixing.
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-30 18:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29 17:52 [PATCH iproute2] bridge: mdb: restore text output format Nikolay Aleksandrov
2019-05-30 18:06 ` Stephen Hemminger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.