]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospfd/ospf_bfd.c
Merge pull request #5468 from qlyoung/bgpd-remove-bgp-attr-dup
[mirror_frr.git] / ospfd / ospf_bfd.c
index 6bff5b8ddbf2951ca514d20ae7b12704273a7db0..b9e78f4cd35df77753c6310299e5fde75a057fba 100644 (file)
@@ -65,6 +65,7 @@ static void ospf_bfd_reg_dereg_nbr(struct ospf_neighbor *nbr, int command)
        struct interface *ifp = oi->ifp;
        struct ospf_if_params *params;
        struct bfd_info *bfd_info;
+       int cbit;
 
        /* Check if BFD is enabled */
        params = IF_DEF_PARAMS(ifp);
@@ -80,8 +81,10 @@ static void ospf_bfd_reg_dereg_nbr(struct ospf_neighbor *nbr, int command)
                           inet_ntoa(nbr->src),
                           ospf_vrf_id_to_name(oi->ospf->vrf_id));
 
+       cbit = CHECK_FLAG(bfd_info->flags, BFD_FLAG_BFD_CBIT_ON);
+
        bfd_peer_sendmsg(zclient, bfd_info, AF_INET, &nbr->src, NULL, ifp->name,
-                        0, 0, command, 0, oi->ospf->vrf_id);
+                        0, 0, cbit, command, 0, oi->ospf->vrf_id);
 }
 
 /*
@@ -156,7 +159,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)) {
@@ -199,15 +202,17 @@ static int ospf_bfd_interface_dest_update(ZAPI_CALLBACK_ARGS)
        struct interface *ifp;
        struct ospf_interface *oi;
        struct ospf_if_params *params;
-       struct ospf_neighbor *nbr;
+       struct ospf_neighbor *nbr = NULL;
        struct route_node *node;
+       struct route_node *n_node;
        struct prefix p;
        int status;
        int old_status;
        struct bfd_info *bfd_info;
        struct timeval tv;
 
-       ifp = bfd_get_peer_info(zclient->ibuf, &p, NULL, &status, vrf_id);
+       ifp = bfd_get_peer_info(zclient->ibuf, &p, NULL, &status,
+                               NULL, vrf_id);
 
        if ((ifp == NULL) || (p.family != AF_INET))
                return 0;
@@ -227,7 +232,28 @@ static int ospf_bfd_interface_dest_update(ZAPI_CALLBACK_ARGS)
                if ((oi = node->info) == NULL)
                        continue;
 
-               nbr = ospf_nbr_lookup_by_addr(oi->nbrs, &p.u.prefix4);
+               /* walk the neighbor list for point-to-point network */
+               if (oi->type == OSPF_IFTYPE_POINTOPOINT) {
+                       for (n_node = route_top(oi->nbrs); n_node;
+                               n_node = route_next(n_node)) {
+                               nbr = n_node->info;
+                               if (nbr) {
+                                       /* skip myself */
+                                       if (nbr == oi->nbr_self) {
+                                               nbr = NULL;
+                                               continue;
+                                       }
+
+                                       /* Found the matching neighbor */
+                                       if (nbr->src.s_addr ==
+                                               p.u.prefix4.s_addr)
+                                               break;
+                               }
+                       }
+               } else {
+                       nbr = ospf_nbr_lookup_by_addr(oi->nbrs, &p.u.prefix4);
+               }
+
                if (!nbr || !nbr->bfd_info)
                        continue;
 
@@ -236,7 +262,7 @@ static int ospf_bfd_interface_dest_update(ZAPI_CALLBACK_ARGS)
                        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;