Browse Source

bgpd: fix fast external fallover behavior

ISSUES

1. When an interface goes down, the zclient callbacks are invoked
   in the following order: (a) address_delete() that removes the
   connected address list: ifp->connected, (b) interface_down()
   that performs "fast external fallover" operation. The operation
   relies on ifp->connected to look for peers that should be brought
   down. That's a cyclic dependency.

2. 'ttl-security' configuration handler sets peer->ttl to
   MAXTTL (so that BGP packets are sent with TTL=255, as per the
   requirement of ttl-security). This, however, is incompatible
   with 'fast external fallover' as the fallover operation checks
   for (ttl == 1) to determine directly connected peers.

3. The current fallover operation does not work for IPv6 address family.

PATCH

1. The patch removes the dependency on 'ifp->connected' list for fast
   fallover. The peer already contains a nexthop structure that reflects
   the peering address. The nexthop structure has a pointer to the
   interface (ifp) that peering address resolves to. Everytime the TCP
   connection succeeds, the ifp is updated. The patch uses this ifp in
   the interface_down() callback for a match for the peers that should be
   brought down.

2. The evaluation for directly connected peering is enhanced as
   'peer->ttl == 1' OR 'peer->gtsm_hops == 1'. Thus a ttl-security
   configuration on the peer with one hop is directly connected and
   should be brought down under 'fast external fallover'.

3. Because of fix (1), IPv6 address family works automatically.

Signed-off-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Pradosh Mohapatra 7 years ago
parent
commit
8da8689d91
1 changed files with 3 additions and 9 deletions
  1. 3 9
      bgpd/bgp_zebra.c

+ 3 - 9
bgpd/bgp_zebra.c

@@ -147,12 +147,11 @@ bgp_interface_down (int command, struct zclient *zclient, zebra_size_t length)
   for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, c))
     bgp_connected_delete (c);
 
-  /* Fast external-failover (Currently IPv4 only) */
+  /* Fast external-failover */
   {
     struct listnode *mnode;
     struct bgp *bgp;
     struct peer *peer;
-    struct interface *peer_if;
 
     for (ALL_LIST_ELEMENTS_RO (bm->bgp, mnode, bgp))
       {
@@ -161,15 +160,10 @@ bgp_interface_down (int command, struct zclient *zclient, zebra_size_t length)
 
 	for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
 	  {
-	    if (peer->ttl != 1)
+	    if ((peer->ttl != 1) && (peer->gtsm_hops != 1))
 	      continue;
 
-	    if (peer->su.sa.sa_family == AF_INET)
-	      peer_if = if_lookup_by_ipv4 (&peer->su.sin.sin_addr);
-	    else
-	      continue;
-
-	    if (ifp == peer_if)
+	    if (ifp == peer->nexthop.ifp)
 	      BGP_EVENT_ADD (peer, BGP_Stop);
 	  }
       }