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);
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);
}
/*
* ospf_bfd_nbr_replay - Replay all the neighbors that have BFD enabled
* to zebra
*/
-static int ospf_bfd_nbr_replay(int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+static int ospf_bfd_nbr_replay(ZAPI_CALLBACK_ARGS)
{
struct listnode *inode, *node, *onode;
struct ospf *ospf;
}
/* 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)) {
* connectivity if the BFD status changed to
* down.
*/
-static int ospf_bfd_interface_dest_update(int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+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;
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;
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;
OSPF_NSM_EVENT_SCHEDULE(nbr, NSM_InactivityTimer);
}
+ if ((status == BFD_STATUS_UP)
+ && (old_status == BFD_STATUS_DOWN)) {
+ if (IS_DEBUG_OSPF(nsm, NSM_EVENTS))
+ zlog_debug("NSM[%s:%s]: BFD Up",
+ IF_NAME(nbr->oi),
+ inet_ntoa(nbr->address.u.prefix4));
+ }
}
return 0;