if (!CHECK_FLAG (peer->flags, PEER_FLAG_BFD))
continue;
- if (dp.family == AF_INET)
- if (dp.u.prefix4.s_addr != peer->su.sin.sin_addr.s_addr)
- continue;
+ if ((dp.family == AF_INET) && (peer->su.sa.sa_family == AF_INET))
+ {
+ if (dp.u.prefix4.s_addr != peer->su.sin.sin_addr.s_addr)
+ continue;
+ }
#ifdef HAVE_IPV6
- else if (dp.family == AF_INET6)
- if (!memcmp(&dp.u.prefix6, &peer->su.sin6.sin6_addr,
- sizeof (struct in6_addr)))
- continue;
+ else if ((dp.family == AF_INET6) &&
+ (peer->su.sa.sa_family == AF_INET6))
+ {
+ if (memcmp(&dp.u.prefix6, &peer->su.sin6.sin6_addr,
+ sizeof (struct in6_addr)))
+ continue;
+ }
#endif
else
continue;
if (ifp && (ifp == peer->nexthop.ifp))
+ {
+ peer->last_reset = PEER_DOWN_BFD_DOWN;
BGP_EVENT_ADD (peer, BGP_Stop);
+ }
else
{
if (!peer->su_local)
continue;
- if (sp.family == AF_INET)
- if (sp.u.prefix4.s_addr != peer->su_local->sin.sin_addr.s_addr)
- continue;
+ if ((sp.family == AF_INET) &&
+ (peer->su_local->sa.sa_family == AF_INET))
+ {
+ if (sp.u.prefix4.s_addr != peer->su_local->sin.sin_addr.s_addr)
+ continue;
+ }
#ifdef HAVE_IPV6
- else if (sp.family == AF_INET6)
- if (!memcmp(&sp.u.prefix6, &peer->su_local->sin6.sin6_addr,
- sizeof (struct in6_addr)))
- continue;
+ else if ((sp.family == AF_INET6) &&
+ (peer->su_local->sa.sa_family == AF_INET6))
+ {
+ if (memcmp(&sp.u.prefix6, &peer->su_local->sin6.sin6_addr,
+ sizeof (struct in6_addr)))
+ continue;
+ }
#endif
else
continue;
+
+ peer->last_reset = PEER_DOWN_BFD_DOWN;
BGP_EVENT_ADD (peer, BGP_Stop);
}
}
#define PEER_DOWN_MULTIHOP_CHANGE 21 /* neighbor multihop command */
#define PEER_DOWN_NSF_CLOSE_SESSION 22 /* NSF tcp session close */
#define PEER_DOWN_V6ONLY_CHANGE 23 /* if-based peering v6only toggled */
+#define PEER_DOWN_BFD_DOWN 24 /* BFD down */
unsigned long last_reset_cause_size;
u_char last_reset_cause[BGP_MAX_PACKET_SIZE];