]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
bridge: mdb: restore text output format
authorNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Wed, 29 May 2019 17:52:42 +0000 (20:52 +0300)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 30 May 2019 18:01:53 +0000 (11:01 -0700)
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>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
bridge/mdb.c

index 59aa176435170f7768298ac3dbe56862b839aaa7..eadc6212af707f3764e636c6284e27688b67567f 100644 (file)
@@ -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)