summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPradosh Mohapatra <pmohapat@cumulusnetworks.com>2013-09-11 03:33:55 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2014-05-19 23:25:39 +0200
commit8da8689d91a6436c17aca5000b1426aaea47e23c (patch)
treef4929119d4f41c668708d19374719765d7cb7f25
parent3374bef0412ac11815779f54321cbc4bf96da909 (diff)
downloadquagga-8da8689d91a6436c17aca5000b1426aaea47e23c.tar.bz2
quagga-8da8689d91a6436c17aca5000b1426aaea47e23c.tar.xz
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>
-rw-r--r--bgpd/bgp_zebra.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 26b97c2c..0f212321 100644
--- a/bgpd/bgp_zebra.c
+++ b/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);
}
}