diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index 45e45977a4..a9c30acafb 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -96,13 +96,12 @@ int bgp_bfd_is_peer_multihop(struct peer *peer) static void bgp_bfd_peer_sendmsg(struct peer *peer, int command) { struct bfd_info *bfd_info; - vrf_id_t vrf_id = VRF_DEFAULT; int multihop; + vrf_id_t vrf_id; bfd_info = (struct bfd_info *)peer->bfd_info; - if (peer->bgp->inst_type == BGP_INSTANCE_TYPE_VRF) - vrf_id = peer->bgp->vrf_id; + vrf_id = peer->bgp->vrf_id; if (command == ZEBRA_BFD_DEST_DEREGISTER) { multihop = @@ -244,7 +243,7 @@ static int bgp_bfd_dest_replay(ZAPI_CALLBACK_ARGS) zlog_debug("Zebra: BFD Dest replay request"); /* Send the client registration */ - bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER); + bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER, vrf_id); /* Replay the peer, if BFD is enabled in BGP */ diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index d47c1f9638..a45480fdc2 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -2441,7 +2441,7 @@ static void bgp_zebra_connected(struct zclient *zclient) bgp_zebra_instance_register(bgp); /* Send the client registration */ - bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER); + bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER, bgp->vrf_id); /* tell label pool that zebra is connected */ bgp_lp_event_zebra_up(); diff --git a/isisd/isis_bfd.c b/isisd/isis_bfd.c index a98c44eeb0..fccef0169e 100644 --- a/isisd/isis_bfd.c +++ b/isisd/isis_bfd.c @@ -139,7 +139,7 @@ static int isis_bfd_interface_dest_update(ZAPI_CALLBACK_ARGS) static int isis_bfd_nbr_replay(ZAPI_CALLBACK_ARGS) { - bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER); + bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER, vrf_id); struct listnode *anode; struct isis_area *area; @@ -167,7 +167,7 @@ static void isis_bfd_zebra_connected(struct zclient *zclient) if (orig_zebra_connected) orig_zebra_connected(zclient); - bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER); + bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER, VRF_DEFAULT); } static void bfd_debug(struct in_addr *dst, struct in_addr *src, diff --git a/lib/bfd.c b/lib/bfd.c index 7e27a64de7..a8956c315c 100644 --- a/lib/bfd.c +++ b/lib/bfd.c @@ -433,7 +433,8 @@ void bfd_show_info(struct vty *vty, struct bfd_info *bfd_info, int multihop, * bfd_client_sendmsg - Format and send a client register * command to Zebra to be forwarded to BFD */ -void bfd_client_sendmsg(struct zclient *zclient, int command) +void bfd_client_sendmsg(struct zclient *zclient, int command, + vrf_id_t vrf_id) { struct stream *s; int ret; @@ -450,7 +451,7 @@ void bfd_client_sendmsg(struct zclient *zclient, int command) s = zclient->obuf; stream_reset(s); - zclient_create_header(s, command, VRF_DEFAULT); + zclient_create_header(s, command, vrf_id); stream_putl(s, getpid()); diff --git a/lib/bfd.h b/lib/bfd.h index a93875c4cf..d02110a997 100644 --- a/lib/bfd.h +++ b/lib/bfd.h @@ -102,7 +102,8 @@ extern void bfd_show_info(struct vty *vty, struct bfd_info *bfd_info, int multihop, int extra_space, bool use_json, json_object *json_obj); -extern void bfd_client_sendmsg(struct zclient *zclient, int command); +extern void bfd_client_sendmsg(struct zclient *zclient, int command, + vrf_id_t vrf_id); extern void bfd_gbl_init(void); diff --git a/ospf6d/ospf6_bfd.c b/ospf6d/ospf6_bfd.c index 3394bd75db..7a26af1f09 100644 --- a/ospf6d/ospf6_bfd.c +++ b/ospf6d/ospf6_bfd.c @@ -151,7 +151,7 @@ static int ospf6_bfd_nbr_replay(ZAPI_CALLBACK_ARGS) zlog_debug("Zebra: BFD Dest replay request"); /* Send the client registration */ - bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER); + bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER, vrf_id); /* Replay the neighbor, if BFD is enabled on the interface*/ FOR_ALL_INTERFACES (vrf, ifp) { diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index 8db4ffef18..af16c5aa7c 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -571,7 +571,7 @@ uint8_t ospf6_distance_apply(struct prefix_ipv6 *p, struct ospf6_route * or) static void ospf6_zebra_connected(struct zclient *zclient) { /* Send the client registration */ - bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER); + bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER, VRF_DEFAULT); zclient_send_reg_requests(zclient, VRF_DEFAULT); } diff --git a/ospfd/ospf_bfd.c b/ospfd/ospf_bfd.c index 6bff5b8ddb..c8ad6d04f4 100644 --- a/ospfd/ospf_bfd.c +++ b/ospfd/ospf_bfd.c @@ -156,7 +156,7 @@ static int ospf_bfd_nbr_replay(ZAPI_CALLBACK_ARGS) } /* Send the client registration */ - bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER); + bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER, vrf_id); /* Replay the neighbor, if BFD is enabled in OSPF */ for (ALL_LIST_ELEMENTS(om->ospf, node, onode, ospf)) { diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index 16796e68fb..c178e367d3 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -1565,7 +1565,7 @@ void ospf_zebra_vrf_deregister(struct ospf *ospf) static void ospf_zebra_connected(struct zclient *zclient) { /* Send the client registration */ - bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER); + bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER, VRF_DEFAULT); zclient_send_reg_requests(zclient, VRF_DEFAULT); } diff --git a/pimd/pim_bfd.c b/pimd/pim_bfd.c index 82087c4c56..300261e5a9 100644 --- a/pimd/pim_bfd.c +++ b/pimd/pim_bfd.c @@ -297,7 +297,7 @@ static int pim_bfd_nbr_replay(ZAPI_CALLBACK_ARGS) struct vrf *vrf = NULL; /* Send the client registration */ - bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER); + bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER, vrf_id); RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) { FOR_ALL_INTERFACES (vrf, ifp) { diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index 11d39bb84f..521c70ee62 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -780,7 +780,7 @@ void sched_rpf_cache_refresh(struct pim_instance *pim) static void pim_zebra_connected(struct zclient *zclient) { /* Send the client registration */ - bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER); + bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER, router->vrf_id); zclient_send_reg_requests(zclient, router->vrf_id); }