summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_nb_state.c
diff options
context:
space:
mode:
authorChirag Shah <chirag@cumulusnetworks.com>2020-05-22 07:01:09 +0200
committerChirag Shah <chirag@cumulusnetworks.com>2020-07-17 20:58:25 +0200
commit20e310a9b27f825973e96e600b3953f4781e2419 (patch)
treebd72ab44166cb99699384662480ac4c78f22946a /zebra/zebra_nb_state.c
parentMerge pull request #6760 from opensourcerouting/build-assorted-20200717 (diff)
downloadfrr-20e310a9b27f825973e96e600b3953f4781e2419.tar.xz
frr-20e310a9b27f825973e96e600b3953f4781e2419.zip
zebra: rib operational nb add vrf key
Add vrf as key in Rib operational nexthop list PR 6296 has added vrf as key in nexthop list. Rib operational model uses nexthop list, adding vrf key into northbound callback. Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_nb_state.c')
-rw-r--r--zebra/zebra_nb_state.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/zebra/zebra_nb_state.c b/zebra/zebra_nb_state.c
index b5fde5f03..19ad3769e 100644
--- a/zebra/zebra_nb_state.c
+++ b/zebra/zebra_nb_state.c
@@ -525,54 +525,57 @@ int lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_nexthop_get_keys(
{
struct nexthop *nexthop = (struct nexthop *)args->list_entry;
- args->keys->num = 3;
+ args->keys->num = 4;
strlcpy(args->keys->key[0], yang_nexthop_type2str(nexthop->type),
sizeof(args->keys->key[0]));
+ snprintfrr(args->keys->key[1], sizeof(args->keys->key[1]), "%" PRIu32,
+ nexthop->vrf_id);
+
switch (nexthop->type) {
case NEXTHOP_TYPE_IPV4:
case NEXTHOP_TYPE_IPV4_IFINDEX:
- snprintfrr(args->keys->key[1], sizeof(args->keys->key[1]),
+ snprintfrr(args->keys->key[2], sizeof(args->keys->key[2]),
"%pI4", &nexthop->gate.ipv4);
if (nexthop->ifindex)
- strlcpy(args->keys->key[2],
+ strlcpy(args->keys->key[3],
ifindex2ifname(nexthop->ifindex,
nexthop->vrf_id),
- sizeof(args->keys->key[2]));
+ sizeof(args->keys->key[3]));
else
/* no ifindex */
- strlcpy(args->keys->key[2], " ",
- sizeof(args->keys->key[2]));
+ strlcpy(args->keys->key[3], " ",
+ sizeof(args->keys->key[3]));
break;
case NEXTHOP_TYPE_IPV6:
case NEXTHOP_TYPE_IPV6_IFINDEX:
- snprintfrr(args->keys->key[1], sizeof(args->keys->key[1]),
+ snprintfrr(args->keys->key[2], sizeof(args->keys->key[2]),
"%pI6", &nexthop->gate.ipv6);
if (nexthop->ifindex)
- strlcpy(args->keys->key[2],
+ strlcpy(args->keys->key[3],
ifindex2ifname(nexthop->ifindex,
nexthop->vrf_id),
- sizeof(args->keys->key[2]));
+ sizeof(args->keys->key[3]));
else
/* no ifindex */
- strlcpy(args->keys->key[2], " ",
- sizeof(args->keys->key[2]));
+ strlcpy(args->keys->key[3], " ",
+ sizeof(args->keys->key[3]));
break;
case NEXTHOP_TYPE_IFINDEX:
- strlcpy(args->keys->key[1], "", sizeof(args->keys->key[1]));
- strlcpy(args->keys->key[2],
+ strlcpy(args->keys->key[2], "", sizeof(args->keys->key[2]));
+ strlcpy(args->keys->key[3],
ifindex2ifname(nexthop->ifindex, nexthop->vrf_id),
- sizeof(args->keys->key[2]));
+ sizeof(args->keys->key[3]));
break;
case NEXTHOP_TYPE_BLACKHOLE:
/* Gateway IP */
- strlcpy(args->keys->key[1], "", sizeof(args->keys->key[1]));
- strlcpy(args->keys->key[2], " ", sizeof(args->keys->key[2]));
+ strlcpy(args->keys->key[2], "", sizeof(args->keys->key[2]));
+ strlcpy(args->keys->key[3], " ", sizeof(args->keys->key[3]));
break;
default:
break;