diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c index d88c52d1f6d9..a81c08147a47 100644 --- a/bgpd/bgp_evpn_mh.c +++ b/bgpd/bgp_evpn_mh.c @@ -2851,6 +2851,7 @@ static void bgp_evpn_l3nhg_zebra_add_v4_or_v6(struct bgp_evpn_es_vrf *es_vrf, if (!api_nhg.nexthop_num) return; + api_nhg.vrf_id = VRF_DEFAULT; zclient_nhg_send(zclient, ZEBRA_NHG_ADD, &api_nhg); } @@ -2895,6 +2896,7 @@ static void bgp_evpn_l3nhg_zebra_del_v4_or_v6(struct bgp_evpn_es_vrf *es_vrf, frrtrace(4, frr_bgp, evpn_mh_nhg_zsend, false, v4_nhg, api_nhg.id, es_vrf); + api_nhg.vrf_id = VRF_DEFAULT; zclient_nhg_send(zclient, ZEBRA_NHG_DEL, &api_nhg); } diff --git a/lib/zclient.c b/lib/zclient.c index 1b2ff02f6137..40f102ebbbcd 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -1164,7 +1164,7 @@ static int zapi_nhg_encode(struct stream *s, int cmd, struct zapi_nhg *api_nhg) } stream_reset(s); - zclient_create_header(s, cmd, VRF_DEFAULT); + zclient_create_header(s, cmd, api_nhg->vrf_id); stream_putw(s, api_nhg->proto); stream_putl(s, api_nhg->id); diff --git a/lib/zclient.h b/lib/zclient.h index 8b6aebc2fda8..a884592382e5 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -486,6 +486,8 @@ struct zapi_nhg { uint16_t backup_nexthop_num; struct zapi_nexthop backup_nexthops[MULTIPATH_NUM]; + + uint32_t vrf_id; }; /* diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c index ff4895189db6..e01d06332e1b 100644 --- a/sharpd/sharp_zebra.c +++ b/sharpd/sharp_zebra.c @@ -539,6 +539,7 @@ void nhg_add(uint32_t id, const struct nexthop_group *nhg, bool is_valid = true; api_nhg.id = id; + api_nhg.vrf_id = VRF_DEFAULT; api_nhg.resilience = nhg->nhgr; diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 761eafeb1375..3569f153d035 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -1962,6 +1962,7 @@ static void zread_nhg_del(ZAPI_HANDLER_ARGS) /* Create a temporary nhe */ nhe = zebra_nhg_alloc(); nhe->id = api_nhg.id; + nhe->vrf_id = zvrf_id(zvrf); nhe->type = api_nhg.proto; nhe->zapi_instance = client->instance; nhe->zapi_session = client->session_id; @@ -2165,6 +2166,7 @@ static void zread_route_add(ZAPI_HANDLER_ARGS) */ if (!re->nhe_id) { zebra_nhe_init(&nhe, afi, ng->nexthop); + nhe.vrf_id = re->vrf_id; nhe.nhg.nexthop = ng->nexthop; nhe.backup_info = bnhg; n = zebra_nhe_copy(&nhe, 0); diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 93758cca2017..fb9a908786b0 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -3423,6 +3423,7 @@ struct nhg_hash_entry *zebra_nhg_proto_add(uint32_t id, int type, lookup.nhg.nhgr = nhg->nhgr; lookup.id = id; lookup.type = type; + lookup.vrf_id = nhe->vrf_id; old = zebra_nhg_lookup_id(id); diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 4b5f81a3df51..5ae8e43ee5c3 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -4373,6 +4373,7 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p, else if (re->nhe_id > 0) nhe.id = re->nhe_id; + nhe.vrf_id = re->vrf_id; n = zebra_nhe_copy(&nhe, 0); ret = rib_add_multipath_nhe(afi, safi, p, src_p, re, n, startup);