summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2016-09-09 01:37:42 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-09-09 01:37:42 +0200
commitdfee47aa92d9cda6c2fe4f9873bfe1ae808bae57 (patch)
tree73cfb27167349081bf270020e8c270c926c331d7
parentbgpd: Allow bgp to work standalone (diff)
parentquagga-reload.py fails for "net add debug ospf6 lsa as-ext" (diff)
downloadfrr-dfee47aa92d9cda6c2fe4f9873bfe1ae808bae57.tar.xz
frr-dfee47aa92d9cda6c2fe4f9873bfe1ae808bae57.zip
Merge remote-tracking branch 'origin/cmaster' into cmaster-next
-rw-r--r--bgpd/bgp_bfd.c2
-rw-r--r--bgpd/bgp_bfd.h3
-rw-r--r--bgpd/bgp_nht.c19
-rw-r--r--bgpd/bgp_zebra.c10
-rw-r--r--lib/nexthop.c33
-rw-r--r--lib/nexthop.h4
6 files changed, 68 insertions, 3 deletions
diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c
index b0c812cca..ad221d922 100644
--- a/bgpd/bgp_bfd.c
+++ b/bgpd/bgp_bfd.c
@@ -73,7 +73,7 @@ bgp_bfd_peer_group2peer_copy(struct peer *conf, struct peer *peer)
/*
* bgp_bfd_is_peer_multihop - returns whether BFD peer is multi-hop or single hop.
*/
-static int
+int
bgp_bfd_is_peer_multihop(struct peer *peer)
{
struct bfd_info *bfd_info;
diff --git a/bgpd/bgp_bfd.h b/bgpd/bgp_bfd.h
index 4e554af69..e872637e3 100644
--- a/bgpd/bgp_bfd.h
+++ b/bgpd/bgp_bfd.h
@@ -42,4 +42,7 @@ bgp_bfd_peer_config_write(struct vty *vty, struct peer *peer, char *addr);
extern void
bgp_bfd_show_info(struct vty *vty, struct peer *peer, u_char use_json, json_object *json_neigh);
+extern int
+bgp_bfd_is_peer_multihop(struct peer *peer);
+
#endif /* _QUAGGA_BGP_BFD_H */
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index cdee80a0b..ef70d0e4f 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -371,8 +371,8 @@ bgp_parse_nexthop_update (int command, vrf_id_t vrf_id)
{
char buf[PREFIX2STR_BUFFER];
prefix2str(&p, buf, sizeof (buf));
- zlog_debug("parse nexthop update(%s): metric=%d, #nexthop=%d", buf,
- metric, nexthop_num);
+ zlog_debug("%d: NH update for %s - metric %d (cur %d) #nhops %d (cur %d)",
+ vrf_id, buf, metric, bnc->metric, nexthop_num, bnc->nexthop_num);
}
if (metric != bnc->metric)
@@ -419,6 +419,13 @@ bgp_parse_nexthop_update (int command, vrf_id_t vrf_id)
break;
}
+ if (BGP_DEBUG(nht, NHT))
+ {
+ char buf[NEXTHOP_STRLEN];
+ zlog_debug(" nhop via %s",
+ nexthop2str (nexthop, buf, sizeof (buf)));
+ }
+
if (nhlist_tail)
{
nhlist_tail->next = nexthop;
@@ -641,6 +648,14 @@ evaluate_paths (struct bgp_nexthop_cache *bnc)
int afi;
struct peer *peer = (struct peer *)bnc->nht_info;
+ if (BGP_DEBUG(nht, NHT))
+ {
+ char buf[PREFIX2STR_BUFFER];
+ bnc_str(bnc, buf, PREFIX2STR_BUFFER);
+ zlog_debug("NH update for %s - flags 0x%x chgflags 0x%x - evaluate paths",
+ buf, bnc->flags, bnc->change_flags);
+ }
+
LIST_FOREACH(path, &(bnc->paths), nh_thread)
{
if (!(path->type == ZEBRA_ROUTE_BGP &&
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 81bede0e9..c2df521e7 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -45,6 +45,7 @@ Boston, MA 02111-1307, USA. */
#include "bgpd/bgp_mpath.h"
#include "bgpd/bgp_nexthop.h"
#include "bgpd/bgp_nht.h"
+#include "bgpd/bgp_bfd.h"
/* All information about zebra. */
struct zclient *zclient = NULL;
@@ -359,7 +360,16 @@ bgp_interface_down (int command, struct zclient *zclient, zebra_size_t length,
for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
{
+#if defined(HAVE_CUMULUS)
+ /* Take down directly connected EBGP peers as well as 1-hop BFD
+ * tracked (directly connected) IBGP peers.
+ */
+ if ((peer->ttl != 1) && (peer->gtsm_hops != 1) &&
+ (!peer->bfd_info || bgp_bfd_is_peer_multihop(peer)))
+#else
+ /* Take down directly connected EBGP peers */
if ((peer->ttl != 1) && (peer->gtsm_hops != 1))
+#endif
continue;
if (ifp == peer->nexthop.ifp)
diff --git a/lib/nexthop.c b/lib/nexthop.c
index 585388421..14486ea15 100644
--- a/lib/nexthop.c
+++ b/lib/nexthop.c
@@ -153,3 +153,36 @@ nexthops_free (struct nexthop *nexthop)
nexthop_free (nh);
}
}
+
+const char *
+nexthop2str (struct nexthop *nexthop, char *str, int size)
+{
+ switch (nexthop->type)
+ {
+ case NEXTHOP_TYPE_IFINDEX:
+ snprintf (str, size, "if %u", nexthop->ifindex);
+ break;
+ case NEXTHOP_TYPE_IPV4:
+ snprintf (str, size, "%s", inet_ntoa (nexthop->gate.ipv4));
+ break;
+ case NEXTHOP_TYPE_IPV4_IFINDEX:
+ snprintf (str, size, "%s if %u",
+ inet_ntoa (nexthop->gate.ipv4), nexthop->ifindex);
+ break;
+ case NEXTHOP_TYPE_IPV6:
+ snprintf (str, size, "%s", inet6_ntoa (nexthop->gate.ipv6));
+ break;
+ case NEXTHOP_TYPE_IPV6_IFINDEX:
+ snprintf (str, size, "%s if %u",
+ inet6_ntoa (nexthop->gate.ipv6), nexthop->ifindex);
+ break;
+ case NEXTHOP_TYPE_BLACKHOLE:
+ snprintf (str, size, "blackhole");
+ break;
+ default:
+ snprintf (str, size, "unknown");
+ break;
+ }
+
+ return str;
+}
diff --git a/lib/nexthop.h b/lib/nexthop.h
index 4445c4ad2..39e8b5425 100644
--- a/lib/nexthop.h
+++ b/lib/nexthop.h
@@ -26,6 +26,9 @@
#include "prefix.h"
+/* Maximum next hop string length - gateway + ifindex */
+#define NEXTHOP_STRLEN (INET6_ADDRSTRLEN + 30)
+
union g_addr {
struct in_addr ipv4;
struct in6_addr ipv6;
@@ -97,4 +100,5 @@ void nexthops_free (struct nexthop *nexthop);
extern const char *nexthop_type_to_str (enum nexthop_types_t nh_type);
extern int nexthop_same_no_recurse (struct nexthop *next1, struct nexthop *next2);
+extern const char * nexthop2str (struct nexthop *nexthop, char *str, int size);
#endif /*_LIB_NEXTHOP_H */