mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-10-11 19:42:21 +00:00
bridge: Fix garbled json output seen if a vlan filter is specified
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>
This commit is contained in:
parent
6cf2609ddb
commit
afd3921ea9
10
bridge/fdb.c
10
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)
|
if (filter_index && filter_index != r->ndm_ifindex)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (jw_global) {
|
|
||||||
jsonw_pretty(jw_global, 1);
|
|
||||||
jsonw_start_object(jw_global);
|
|
||||||
}
|
|
||||||
|
|
||||||
parse_rtattr(tb, NDA_MAX, NDA_RTA(r),
|
parse_rtattr(tb, NDA_MAX, NDA_RTA(r),
|
||||||
n->nlmsg_len - NLMSG_LENGTH(sizeof(*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)
|
if (filter_vlan && filter_vlan != vid)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (jw_global) {
|
||||||
|
jsonw_pretty(jw_global, 1);
|
||||||
|
jsonw_start_object(jw_global);
|
||||||
|
}
|
||||||
|
|
||||||
if (n->nlmsg_type == RTM_DELNEIGH) {
|
if (n->nlmsg_type == RTM_DELNEIGH) {
|
||||||
if (jw_global)
|
if (jw_global)
|
||||||
jsonw_string_field(jw_global, "opCode", "deleted");
|
jsonw_string_field(jw_global, "opCode", "deleted");
|
||||||
|
Loading…
Reference in New Issue
Block a user