]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgp, ospfd, ospf6d, pimd, lib, isisd: add bfd_client_sendmsg vrf_id
authorPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 26 Mar 2019 13:29:13 +0000 (14:29 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 7 May 2019 13:53:07 +0000 (15:53 +0200)
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>
bgpd/bgp_bfd.c
bgpd/bgp_zebra.c
isisd/isis_bfd.c
lib/bfd.c
lib/bfd.h
ospf6d/ospf6_bfd.c
ospf6d/ospf6_zebra.c
ospfd/ospf_bfd.c
ospfd/ospf_zebra.c
pimd/pim_bfd.c
pimd/pim_zebra.c

index 45e45977a4ada851fe0cfcb29e6a5aadd20840de..a9c30acafbf711d7cb314ae7317aa87ea5014403 100644 (file)
@@ -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 */
 
index d47c1f96388cb355246158b98cc89d7458b7c9b2..a45480fdc27c0d7a65c3978bc27b985893ca9fdb 100644 (file)
@@ -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();
index a98c44eeb0e8094169ae9dffdeb6fa4a9e20606d..fccef0169e77c29c4a0671a94b64473394adf0de 100644 (file)
@@ -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,
index 7e27a64de7bcc20f490b61e3240d0fc945977065..a8956c315cc68e2c5c845b6841d6a3aad83c65f9 100644 (file)
--- 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());
 
index a93875c4cf80e1a6ef74845f2ca93b681f28ef32..d02110a9970cea35d6833c157fc114bdebe46217 100644 (file)
--- 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);
 
index 3394bd75db854706db7c2ce821dc8fe4ea7199ba..7a26af1f09ac36fb08360fedf14c149c9e28e74f 100644 (file)
@@ -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) {
index 8db4ffef18c603f52b5e3d74a7782a678d293d4f..af16c5aa7cded703f57dfca72dfd986a0347f913 100644 (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)
 {
        /* 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);
 }
index 6bff5b8ddbf2951ca514d20ae7b12704273a7db0..c8ad6d04f49ec6de3352bffe4ffccd5f314e9143 100644 (file)
@@ -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)) {
index 16796e68fb6ec6c635069863288f6fbe5547a5a7..c178e367d390a032fcc37df14163950328d8ce69 100644 (file)
@@ -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);
 }
index 82087c4c5635d43704b3093f99c3a07782d530b7..300261e5a996909113c0737bcde1d545d78d75bc 100644 (file)
@@ -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) {
index 11d39bb84f8582b7852e9bb9f0b673d5c9782433..521c70ee629ef3ef63a890e606b205c89608889f 100644 (file)
@@ -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);
 }