summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_bfd.c44
-rw-r--r--bgpd/bgp_fsm.c3
-rw-r--r--bgpd/bgpd.h1
3 files changed, 33 insertions, 15 deletions
diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c
index 3005373d2..02047f7f0 100644
--- a/bgpd/bgp_bfd.c
+++ b/bgpd/bgp_bfd.c
@@ -337,36 +337,52 @@ bgp_interface_bfd_dest_down (int command, struct zclient *zclient,
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);
}
}
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 6948a6def..ec9427bb4 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -475,7 +475,8 @@ const char *peer_down_str[] =
"Passive config change",
"Multihop config change",
"NSF peer closed the session",
- "Intf peering v6only config change"
+ "Intf peering v6only config change",
+ "BFD down received"
};
static int
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 4bbfbf719..1778aadbe 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -799,6 +799,7 @@ struct peer
#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];