summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitesh Kanjariya <mitesh@marvel-07.cumulusnetworks.com>2017-11-05 17:11:43 -0800
committerMitesh Kanjariya <mitesh@marvel-07.cumulusnetworks.com>2017-12-14 10:57:08 -0800
commit408b00c4d73b1975e378ca512cb32c13f9e544d8 (patch)
treef0040f9b29588e749379508b9747f9c4436a78c5
parent6ee86383bb69a21c9bcb215d8e47ca2bb2e82a79 (diff)
bgpd: only advertise valid subnet routes as evpn type-5 routes
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
-rw-r--r--bgpd/bgp_evpn.c7
-rw-r--r--lib/.prefix.h.swobin16384 -> 0 bytes
-rw-r--r--lib/prefix.h9
3 files changed, 16 insertions, 0 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index 1921a9553e..682bdb0075 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -3093,6 +3093,13 @@ void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf,
struct prefix_evpn evp;
char buf[PREFIX_STRLEN];
+ if (!rn->info)
+ continue;
+
+ /* only advertise subnet routes as type-5 */
+ if (is_host_route(&rn->p))
+ continue;
+
build_type5_prefix_from_ip_prefix(&evp, &rn->p);
ret = update_evpn_type5_route(bgp_vrf, &evp);
if (ret) {
diff --git a/lib/.prefix.h.swo b/lib/.prefix.h.swo
deleted file mode 100644
index 51fe596fb3..0000000000
--- a/lib/.prefix.h.swo
+++ /dev/null
Binary files differ
diff --git a/lib/prefix.h b/lib/prefix.h
index aa857f330c..7408c75e11 100644
--- a/lib/prefix.h
+++ b/lib/prefix.h
@@ -399,4 +399,13 @@ static inline int is_default_prefix(const struct prefix *p)
return 0;
}
+static inline int is_host_route(struct prefix *p)
+{
+ if (p->family == AF_INET)
+ return (p->prefixlen == IPV4_MAX_BITLEN);
+ else if (p->family == AF_INET6)
+ return (p->prefixlen == IPV6_MAX_BITLEN);
+ return 0;
+}
+
#endif /* _ZEBRA_PREFIX_H */