bgp, ospfd, ospf6d, pimd, lib, isisd: add bfd_client_sendmsg vrf_id

vrf_id parameter is added to the api of bfd_client_sendmsg().
this permits being registered to bfd from a separate vrf.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
Philippe Guibert 2019-03-26 14:29:13 +01:00
parent 54aadda13d
commit 0945d5ed01
11 changed files with 17 additions and 16 deletions

View File

@ -96,12 +96,11 @@ int bgp_bfd_is_peer_multihop(struct peer *peer)
static void bgp_bfd_peer_sendmsg(struct peer *peer, int command) static void bgp_bfd_peer_sendmsg(struct peer *peer, int command)
{ {
struct bfd_info *bfd_info; struct bfd_info *bfd_info;
vrf_id_t vrf_id = VRF_DEFAULT;
int multihop; int multihop;
vrf_id_t vrf_id;
bfd_info = (struct bfd_info *)peer->bfd_info; 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) { if (command == ZEBRA_BFD_DEST_DEREGISTER) {
@ -244,7 +243,7 @@ static int bgp_bfd_dest_replay(ZAPI_CALLBACK_ARGS)
zlog_debug("Zebra: BFD Dest replay request"); zlog_debug("Zebra: BFD Dest replay request");
/* Send the client registration */ /* 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 */ /* Replay the peer, if BFD is enabled in BGP */

View File

@ -2441,7 +2441,7 @@ static void bgp_zebra_connected(struct zclient *zclient)
bgp_zebra_instance_register(bgp); bgp_zebra_instance_register(bgp);
/* Send the client registration */ /* 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 */ /* tell label pool that zebra is connected */
bgp_lp_event_zebra_up(); bgp_lp_event_zebra_up();

View File

@ -139,7 +139,7 @@ static int isis_bfd_interface_dest_update(ZAPI_CALLBACK_ARGS)
static int isis_bfd_nbr_replay(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 listnode *anode;
struct isis_area *area; struct isis_area *area;
@ -167,7 +167,7 @@ static void isis_bfd_zebra_connected(struct zclient *zclient)
if (orig_zebra_connected) if (orig_zebra_connected)
orig_zebra_connected(zclient); 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, static void bfd_debug(struct in_addr *dst, struct in_addr *src,

View File

@ -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 * bfd_client_sendmsg - Format and send a client register
* command to Zebra to be forwarded to BFD * 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; struct stream *s;
int ret; int ret;
@ -450,7 +451,7 @@ void bfd_client_sendmsg(struct zclient *zclient, int command)
s = zclient->obuf; s = zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_create_header(s, command, VRF_DEFAULT); zclient_create_header(s, command, vrf_id);
stream_putl(s, getpid()); stream_putl(s, getpid());

View File

@ -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, int multihop, int extra_space, bool use_json,
json_object *json_obj); 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); extern void bfd_gbl_init(void);

View File

@ -151,7 +151,7 @@ static int ospf6_bfd_nbr_replay(ZAPI_CALLBACK_ARGS)
zlog_debug("Zebra: BFD Dest replay request"); zlog_debug("Zebra: BFD Dest replay request");
/* Send the client registration */ /* 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*/ /* Replay the neighbor, if BFD is enabled on the interface*/
FOR_ALL_INTERFACES (vrf, ifp) { FOR_ALL_INTERFACES (vrf, ifp) {

View File

@ -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) static void ospf6_zebra_connected(struct zclient *zclient)
{ {
/* Send the client registration */ /* 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); zclient_send_reg_requests(zclient, VRF_DEFAULT);
} }

View File

@ -156,7 +156,7 @@ static int ospf_bfd_nbr_replay(ZAPI_CALLBACK_ARGS)
} }
/* Send the client registration */ /* 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 */ /* Replay the neighbor, if BFD is enabled in OSPF */
for (ALL_LIST_ELEMENTS(om->ospf, node, onode, ospf)) { for (ALL_LIST_ELEMENTS(om->ospf, node, onode, ospf)) {

View File

@ -1565,7 +1565,7 @@ void ospf_zebra_vrf_deregister(struct ospf *ospf)
static void ospf_zebra_connected(struct zclient *zclient) static void ospf_zebra_connected(struct zclient *zclient)
{ {
/* Send the client registration */ /* 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); zclient_send_reg_requests(zclient, VRF_DEFAULT);
} }

View File

@ -297,7 +297,7 @@ static int pim_bfd_nbr_replay(ZAPI_CALLBACK_ARGS)
struct vrf *vrf = NULL; struct vrf *vrf = NULL;
/* Send the client registration */ /* 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) { RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
FOR_ALL_INTERFACES (vrf, ifp) { FOR_ALL_INTERFACES (vrf, ifp) {

View File

@ -780,7 +780,7 @@ void sched_rpf_cache_refresh(struct pim_instance *pim)
static void pim_zebra_connected(struct zclient *zclient) static void pim_zebra_connected(struct zclient *zclient)
{ {
/* Send the client registration */ /* 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); zclient_send_reg_requests(zclient, router->vrf_id);
} }