zebra rib 'show ip route json' lists all nexthops in a flat list.
To identify the recursively resolved
nexthops relation adding a flag "resolver" as delimiter
to identify recursively resolved nexthop in the list.
Testing Done:
{
"1.1.1.0\/24":[
{
"prefix":"1.1.1.0\/24",
"protocol":"static",
....
"nexthops":[
{
"flags":5,
"ip":"27.0.0.14",
"afi":"ipv4",
"active":true,
"recursive":true,
"weight":1
},
{
"flags":3,
"fib":true,
"ip":"fe80::202:ff:fe00:11",
"afi":"ipv6",
"interfaceIndex":12,
"interfaceName":"uplink-1",
"resolver":true, <-- Resolver for recursive true flag nh
"active":true,
"weight":1
},
]
}
]
}
Signed-off-by: Chirag Shah <chirag@nvidia.com>
break;
}
+ /* This nexthop is a resolver for the parent nexthop.
+ * Set resolver flag for better clarity and delimiter
+ * in flat list of nexthops in json.
+ */
+ if (nexthop->rparent)
+ json_object_boolean_true_add(json_nexthop, "resolver");
+
if (nexthop->vrf_id != re->vrf_id)
json_object_string_add(json_nexthop, "vrf",
vrf_id_to_name(nexthop->vrf_id));