Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: fix 'show nexthop-group rib' displays invalid VRF #15084

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bgpd/bgp_evpn_mh.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/zclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions lib/zclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,8 @@ struct zapi_nhg {

uint16_t backup_nexthop_num;
struct zapi_nexthop backup_nexthops[MULTIPATH_NUM];

uint32_t vrf_id;
};

/*
Expand Down
1 change: 1 addition & 0 deletions sharpd/sharp_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions zebra/zapi_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions zebra/zebra_nhg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions zebra/zebra_rib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading