aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Poirier <bpoirier@nvidia.com>2023-12-11 09:07:21 -0500
committerStephen Hemminger <stephen@networkplumber.org>2023-12-22 09:54:23 -0800
commitb627c387eb5c9c8ce37af1fc72fdbc30811fc78d (patch)
tree5adb8b8ff8e921fc7efd7788a2af5c09ceb0cd75
parent060eac10e764c46064aafaaed7d2808ea52858eb (diff)
downloadiproute2-next-b627c387eb5c9c8ce37af1fc72fdbc30811fc78d.tar.gz
bridge: vni: Move open_json_object() within print_vni()
print_vni() is used to output one vni or vni range which, in json output mode, looks like { "vni": 100 } Currently, the closing bracket is handled within the function but the opening bracket is handled by open_json_object() before calling the function. For consistency, move the call to open_json_object() within print_vni(). Reviewed-by: Petr Machata <petrm@nvidia.com> Tested-by: Petr Machata <petrm@nvidia.com> Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
-rw-r--r--bridge/vni.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/bridge/vni.c b/bridge/vni.c
index 51e65b898..8a6ac2458 100644
--- a/bridge/vni.c
+++ b/bridge/vni.c
@@ -242,6 +242,7 @@ static void print_vni(struct rtattr *t, int ifindex)
if (ttb[VXLAN_VNIFILTER_ENTRY_END])
vni_end = rta_getattr_u32(ttb[VXLAN_VNIFILTER_ENTRY_END]);
+ open_json_object(NULL);
if (vni_end)
print_range("vni", vni_start, vni_end);
else
@@ -333,10 +334,8 @@ int print_vnifilter_rtm(struct nlmsghdr *n, void *arg)
continue;
if (first) {
open_vni_port(tmsg->ifindex, "%s");
- open_json_object(NULL);
first = false;
} else {
- open_json_object(NULL);
print_string(PRINT_FP, NULL, "%-" __stringify(IFNAMSIZ) "s ", "");
}