public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [iproute2] bridge: Fix garbled json output seen if a vlan filter is specified
@ 2016-10-07 16:40 Anuradha Karuppiah
  2016-10-10  1:58 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Anuradha Karuppiah @ 2016-10-07 16:40 UTC (permalink / raw)
  To: stephen, netdev; +Cc: roopa, anuradhak

From: anuradhak <anuradhak@cumulusnetworks.com>

json objects were started but not completed if the fdb vlan did not
match the specified filter vlan.

Sample output:
$ bridge -j fdb show vlan 111
[{
        "mac": "44:38:39:00:69:88",
        "dev": "br0",
        "vlan": 111,
        "master": "br0",
        "state": "permanent"
    }
]
$ bridge -j fdb show vlan 100
[]
$

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
---
 bridge/fdb.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/bridge/fdb.c b/bridge/fdb.c
index c6e0379..90f4b15 100644
--- a/bridge/fdb.c
+++ b/bridge/fdb.c
@@ -100,11 +100,6 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
 	if (filter_index && filter_index != r->ndm_ifindex)
 		return 0;
 
-	if (jw_global) {
-		jsonw_pretty(jw_global, 1);
-		jsonw_start_object(jw_global);
-	}
-
 	parse_rtattr(tb, NDA_MAX, NDA_RTA(r),
 		     n->nlmsg_len - NLMSG_LENGTH(sizeof(*r)));
 
@@ -114,6 +109,11 @@ int print_fdb(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
 	if (filter_vlan && filter_vlan != vid)
 		return 0;
 
+	if (jw_global) {
+		jsonw_pretty(jw_global, 1);
+		jsonw_start_object(jw_global);
+	}
+
 	if (n->nlmsg_type == RTM_DELNEIGH) {
 		if (jw_global)
 			jsonw_string_field(jw_global, "opCode", "deleted");
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [iproute2] bridge: Fix garbled json output seen if a vlan filter is specified
  2016-10-07 16:40 [iproute2] bridge: Fix garbled json output seen if a vlan filter is specified Anuradha Karuppiah
@ 2016-10-10  1:58 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2016-10-10  1:58 UTC (permalink / raw)
  To: Anuradha Karuppiah; +Cc: netdev, roopa

On Fri,  7 Oct 2016 09:40:18 -0700
Anuradha Karuppiah <anuradhak@cumulusnetworks.com> wrote:

> From: anuradhak <anuradhak@cumulusnetworks.com>
> 
> json objects were started but not completed if the fdb vlan did not
> match the specified filter vlan.
> 
> Sample output:
> $ bridge -j fdb show vlan 111
> [{
>         "mac": "44:38:39:00:69:88",
>         "dev": "br0",
>         "vlan": 111,
>         "master": "br0",
>         "state": "permanent"
>     }
> ]
> $ bridge -j fdb show vlan 100
> []
> $
> 
> Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>

Applied for 4.8 version

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-10  1:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-07 16:40 [iproute2] bridge: Fix garbled json output seen if a vlan filter is specified Anuradha Karuppiah
2016-10-10  1:58 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox