]> git.puffer.fish Git - matthieu/frr.git/commitdiff
When IPv6 peer BFD down status is received by BGP, all the the peers for which the...
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 22 Jul 2015 19:35:37 +0000 (12:35 -0700)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 22 Jul 2015 19:35:37 +0000 (12:35 -0700)
Also, there is no reason stored in the last_reset field when BGP peer goes down due BFD. Incorrect/no peer down reason can get logged when BGP peer goes down due to BFD. Fixed it by adding new BFD peer down reason code and storing it in the peer last_reset field when peer is broght down due to BFD.

bgpd/bgp_bfd.c
bgpd/bgp_fsm.c
bgpd/bgpd.h

index 3005373d25d93309567ecd0cdb5e215934947f32..02047f7f07e11bb38bd8b45b69a64cdb4dff2e04 100644 (file)
@@ -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);
             }
         }
index 6948a6defbc6afb5eb02027afe78eea0be6ddd4a..ec9427bb497ad07b8f3115d1027525ba2f7fd4b3 100644 (file)
@@ -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
index 4bbfbf7192b9c5fb4df324c05b31a9c82e973ae4..1778aadbef815afe320dbee2eb050138021c1f36 100644 (file)
@@ -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];