summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLou Berger <lberger@labn.net>2019-04-04 10:20:43 -0400
committerGitHub <noreply@github.com>2019-04-04 10:20:43 -0400
commit9ffa0d2404eadad702d6381c35b24eb293dd48f3 (patch)
tree4ac1bc1947de2fba1c4bbed3a96e1937d19d813c
parente9890df15d49052330f1c2501ae949cbfddb30a1 (diff)
parent1eb6c3eae6a3040fdd1f4f88881ca0d0f4669324 (diff)
Merge pull request #4072 from chiragshah6/evpn_dev2
lib,bgpd: do not register nexthop 0.0.0.0 to nht
-rw-r--r--bgpd/bgp_nht.c4
-rw-r--r--lib/prefix.h13
2 files changed, 16 insertions, 1 deletions
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index 2b4ad22b93..6e85abc8df 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -243,8 +243,10 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
if (bgp_route->inst_type == BGP_INSTANCE_TYPE_VIEW) {
SET_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED);
SET_FLAG(bnc->flags, BGP_NEXTHOP_VALID);
- } else if (!CHECK_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED))
+ } else if (!CHECK_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED) &&
+ !is_default_host_route(&bnc->node->p))
register_zebra_rnh(bnc, is_bgp_static_route);
+
if (pi && pi->nexthop != bnc) {
/* Unlink from existing nexthop cache, if any. This will also
* free
diff --git a/lib/prefix.h b/lib/prefix.h
index ae931288c0..a1c2086b8d 100644
--- a/lib/prefix.h
+++ b/lib/prefix.h
@@ -511,6 +511,19 @@ static inline int is_host_route(struct prefix *p)
return 0;
}
+static inline int is_default_host_route(struct prefix *p)
+{
+ if (p->family == AF_INET) {
+ return (p->u.prefix4.s_addr == INADDR_ANY &&
+ p->prefixlen == IPV4_MAX_BITLEN);
+ } else if (p->family == AF_INET6) {
+ return ((!memcmp(&p->u.prefix6, &in6addr_any,
+ sizeof(struct in6_addr))) &&
+ p->prefixlen == IPV6_MAX_BITLEN);
+ }
+ return 0;
+}
+
#ifdef __cplusplus
}
#endif