]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospf6d/ospf6_bfd.c
Merge pull request #5280 from qlyoung/doc-clean-topotest-json
[mirror_frr.git] / ospf6d / ospf6_bfd.c
index fa0030b6d95dd9b1d17c256200b9a5093a5a8d60..4e7a0050aa26227776ed97ee4043b8f78b341c44 100644 (file)
@@ -74,6 +74,7 @@ void ospf6_bfd_reg_dereg_nbr(struct ospf6_neighbor *on, int command)
        struct interface *ifp = oi->interface;
        struct bfd_info *bfd_info;
        char src[64];
+       int cbit;
 
        if (!oi->bfd_info || !on->bfd_info)
                return;
@@ -85,9 +86,11 @@ void ospf6_bfd_reg_dereg_nbr(struct ospf6_neighbor *on, int command)
                           bfd_get_command_dbg_str(command), src);
        }
 
+       cbit = CHECK_FLAG(bfd_info->flags, BFD_FLAG_BFD_CBIT_ON);
+
        bfd_peer_sendmsg(zclient, bfd_info, AF_INET6, &on->linklocal_addr,
-                        on->ospf6_if->linklocal_addr, ifp->name, 0, 0, command,
-                        0, VRF_DEFAULT);
+                        on->ospf6_if->linklocal_addr, ifp->name, 0, 0,
+                        cbit, command, 0, VRF_DEFAULT);
 
        if (command == ZEBRA_BFD_DEST_DEREGISTER)
                bfd_info_free((struct bfd_info **)&on->bfd_info);
@@ -138,10 +141,10 @@ static void ospf6_bfd_reg_dereg_all_nbr(struct ospf6_interface *oi, int command)
  * ospf6_bfd_nbr_replay - Replay all the neighbors that have BFD enabled
  *                        to zebra
  */
-static int ospf6_bfd_nbr_replay(int command, struct zclient *zclient,
-                               zebra_size_t length, vrf_id_t vrf_id)
+static int ospf6_bfd_nbr_replay(ZAPI_CALLBACK_ARGS)
 {
-       struct listnode *inode, *nnode;
+       struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
+       struct listnode *node;
        struct interface *ifp;
        struct ospf6_interface *oi;
        struct ospf6_neighbor *on;
@@ -151,16 +154,16 @@ static int ospf6_bfd_nbr_replay(int command, struct zclient *zclient,
                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_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), inode, ifp)) {
+       FOR_ALL_INTERFACES (vrf, ifp) {
                oi = (struct ospf6_interface *)ifp->info;
 
                if (!oi || !oi->bfd_info)
                        continue;
 
-               for (ALL_LIST_ELEMENTS_RO(oi->neighbor_list, nnode, on)) {
+               for (ALL_LIST_ELEMENTS_RO(oi->neighbor_list, node, on)) {
                        if (on->state < OSPF6_NEIGHBOR_TWOWAY)
                                continue;
 
@@ -181,8 +184,7 @@ static int ospf6_bfd_nbr_replay(int command, struct zclient *zclient,
  *                                   has changed and bring down the neighbor
  *                                   connectivity if BFD down is received.
  */
-static int ospf6_bfd_interface_dest_update(int command, struct zclient *zclient,
-                                          zebra_size_t length, vrf_id_t vrf_id)
+static int ospf6_bfd_interface_dest_update(ZAPI_CALLBACK_ARGS)
 {
        struct interface *ifp;
        struct ospf6_interface *oi;
@@ -196,7 +198,8 @@ static int ospf6_bfd_interface_dest_update(int command, struct zclient *zclient,
        struct bfd_info *bfd_info;
        struct timeval tv;
 
-       ifp = bfd_get_peer_info(zclient->ibuf, &dp, &sp, &status, vrf_id);
+       ifp = bfd_get_peer_info(zclient->ibuf, &dp, &sp, &status,
+                               NULL, vrf_id);
 
        if ((ifp == NULL) || (dp.family != AF_INET6))
                return 0;
@@ -233,7 +236,7 @@ static int ospf6_bfd_interface_dest_update(int command, struct zclient *zclient,
                        continue;
 
                old_status = bfd_info->status;
-               bfd_info->status = status;
+               BFD_SET_CLIENT_STATUS(bfd_info->status, status);
                monotime(&tv);
                bfd_info->last_update = tv.tv_sec;
 
@@ -275,11 +278,14 @@ void ospf6_bfd_info_nbr_create(struct ospf6_interface *oi,
  */
 void ospf6_bfd_write_config(struct vty *vty, struct ospf6_interface *oi)
 {
+#if HAVE_BFDD == 0
        struct bfd_info *bfd_info;
+#endif /* ! HAVE_BFDD */
 
        if (!oi->bfd_info)
                return;
 
+#if HAVE_BFDD == 0
        bfd_info = (struct bfd_info *)oi->bfd_info;
 
        if (CHECK_FLAG(bfd_info->flags, BFD_FLAG_PARAM_CFG))
@@ -287,6 +293,7 @@ void ospf6_bfd_write_config(struct vty *vty, struct ospf6_interface *oi)
                        bfd_info->detect_mult, bfd_info->required_min_rx,
                        bfd_info->desired_min_tx);
        else
+#endif /* ! HAVE_BFDD */
                vty_out(vty, " ipv6 ospf6 bfd\n");
 }
 
@@ -294,8 +301,8 @@ void ospf6_bfd_write_config(struct vty *vty, struct ospf6_interface *oi)
  * ospf6_bfd_if_param_set - Set the configured BFD paramter values for
  *                            interface.
  */
-static void ospf6_bfd_if_param_set(struct ospf6_interface *oi, u_int32_t min_rx,
-                                  u_int32_t min_tx, u_int8_t detect_mult,
+static void ospf6_bfd_if_param_set(struct ospf6_interface *oi, uint32_t min_rx,
+                                  uint32_t min_tx, uint8_t detect_mult,
                                   int defaults)
 {
        int command = 0;
@@ -328,7 +335,12 @@ DEFUN (ipv6_ospf6_bfd,
        return CMD_SUCCESS;
 }
 
-DEFUN (ipv6_ospf6_bfd_param,
+#if HAVE_BFDD > 0
+DEFUN_HIDDEN(
+#else
+DEFUN(
+#endif /* HAVE_BFDD */
+       ipv6_ospf6_bfd_param,
        ipv6_ospf6_bfd_param_cmd,
        "ipv6 ospf6 bfd (2-255) (50-60000) (50-60000)",
        IP6_STR
@@ -343,9 +355,9 @@ DEFUN (ipv6_ospf6_bfd_param,
        int idx_number_2 = 4;
        int idx_number_3 = 5;
        struct ospf6_interface *oi;
-       u_int32_t rx_val;
-       u_int32_t tx_val;
-       u_int8_t dm_val;
+       uint32_t rx_val;
+       uint32_t tx_val;
+       uint8_t dm_val;
        int ret;
 
        assert(ifp);