From fdf19f06f2fd96513d5da7b835155bd607cf999a Mon Sep 17 00:00:00 2001 From: Mitesh Kanjariya Date: Tue, 20 Feb 2018 00:23:06 -0800 Subject: [PATCH 1/5] bgpd: allow advertise-subnet cmd without enabling advertise ipv4 unicast Type-5 routes can be useful in multiple scenarios such as advertise-subnet, default-originate etc. Currently, the code has a restriction that to allow advertising type-5 routes, user has to first enable advertise ipvX command. This restriction is not necessary and should be removed. Signed-off-by: Mitesh Kanjariya --- bgpd/bgp_evpn.c | 28 ++++++++-------------------- bgpd/bgp_evpn.h | 17 +++++++++++++++++ bgpd/bgp_evpn_private.h | 17 ----------------- bgpd/bgp_evpn_vty.c | 12 ++---------- bgpd/bgp_route.c | 4 ++-- 5 files changed, 29 insertions(+), 49 deletions(-) diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index ec8e2907a6..6a3496a4d0 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -2553,10 +2553,12 @@ static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi, static void delete_withdraw_vrf_routes(struct bgp *bgp_vrf) { /* delete all ipv4 routes and withdraw from peers */ - bgp_evpn_withdraw_type5_routes(bgp_vrf, AFI_IP, SAFI_UNICAST); + if (advertise_type5_routes(bgp_vrf, AFI_IP)) + bgp_evpn_withdraw_type5_routes(bgp_vrf, AFI_IP, SAFI_UNICAST); /* delete all ipv6 routes and withdraw from peers */ - bgp_evpn_withdraw_type5_routes(bgp_vrf, AFI_IP6, SAFI_UNICAST); + if (advertise_type5_routes(bgp_vrf, AFI_IP6)) + bgp_evpn_withdraw_type5_routes(bgp_vrf, AFI_IP6, SAFI_UNICAST); } /* update and advertise all ipv4 and ipv6 routes in thr vrf table as type-5 @@ -2564,10 +2566,12 @@ static void delete_withdraw_vrf_routes(struct bgp *bgp_vrf) static void update_advertise_vrf_routes(struct bgp *bgp_vrf) { /* update all ipv4 routes */ - bgp_evpn_advertise_type5_routes(bgp_vrf, AFI_IP, SAFI_UNICAST); + if (advertise_type5_routes(bgp_vrf, AFI_IP)) + bgp_evpn_advertise_type5_routes(bgp_vrf, AFI_IP, SAFI_UNICAST); /* update all ipv6 routes */ - bgp_evpn_advertise_type5_routes(bgp_vrf, AFI_IP6, SAFI_UNICAST); + if (advertise_type5_routes(bgp_vrf, AFI_IP6)) + bgp_evpn_advertise_type5_routes(bgp_vrf, AFI_IP6, SAFI_UNICAST); } /* @@ -3189,10 +3193,6 @@ void bgp_evpn_withdraw_type5_route(struct bgp *bgp_vrf, struct prefix *p, struct prefix_evpn evp; char buf[PREFIX_STRLEN]; - /* NOTE: Check needed as this is called per-route also. */ - if (!advertise_type5_routes(bgp_vrf, afi)) - return; - build_type5_prefix_from_ip_prefix(&evp, p); ret = delete_evpn_type5_route(bgp_vrf, &evp); if (ret) { @@ -3211,10 +3211,6 @@ void bgp_evpn_withdraw_type5_routes(struct bgp *bgp_vrf, struct bgp_table *table = NULL; struct bgp_node *rn = NULL; - /* Bail out early if we don't have to advertise type-5 routes. */ - if (!advertise_type5_routes(bgp_vrf, afi)) - return; - table = bgp_vrf->rib[afi][safi]; for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) bgp_evpn_withdraw_type5_route(bgp_vrf, &rn->p, afi, safi); @@ -3235,10 +3231,6 @@ void bgp_evpn_advertise_type5_route(struct bgp *bgp_vrf, struct prefix *p, struct prefix_evpn evp; char buf[PREFIX_STRLEN]; - /* NOTE: Check needed as this is called per-route also. */ - if (!advertise_type5_routes(bgp_vrf, afi)) - return; - /* only advertise subnet routes as type-5 */ if (is_host_route(p)) return; @@ -3263,10 +3255,6 @@ void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf, struct bgp_node *rn = NULL; struct bgp_info *ri; - /* Bail out early if we don't have to advertise type-5 routes. */ - if (!advertise_type5_routes(bgp_vrf, afi)) - return; - table = bgp_vrf->rib[afi][safi]; for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) { /* Need to identify the "selected" route entry to use its diff --git a/bgpd/bgp_evpn.h b/bgpd/bgp_evpn.h index a8dcbc112b..cd3b7e3af2 100644 --- a/bgpd/bgp_evpn.h +++ b/bgpd/bgp_evpn.h @@ -55,6 +55,23 @@ static inline vni_t label2vni(mpls_label_t *label) return vni; } +static inline int advertise_type5_routes(struct bgp *bgp_vrf, + afi_t afi) +{ + if (!bgp_vrf->l3vni) + return 0; + + if (afi == AFI_IP && + CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV4_IN_EVPN)) + return 1; + + if (afi == AFI_IP6 && + CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV6_IN_EVPN)) + return 1; + + return 0; +} + extern void bgp_evpn_advertise_type5_route(struct bgp *bgp_vrf, struct prefix *p, struct attr *src_attr, diff --git a/bgpd/bgp_evpn_private.h b/bgpd/bgp_evpn_private.h index cc0ec82344..5ff16c39e9 100644 --- a/bgpd/bgp_evpn_private.h +++ b/bgpd/bgp_evpn_private.h @@ -349,23 +349,6 @@ static inline void build_evpn_type3_prefix(struct prefix_evpn *p, p->prefix.ip.ipaddr_v4 = originator_ip; } -static inline int advertise_type5_routes(struct bgp *bgp_vrf, - afi_t afi) -{ - if (!bgp_vrf->l3vni) - return 0; - - if (afi == AFI_IP && - CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV4_IN_EVPN)) - return 1; - - if (afi == AFI_IP6 && - CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV6_IN_EVPN)) - return 1; - - return 0; -} - extern void evpn_rt_delete_auto(struct bgp*, vni_t, struct list*); extern void bgp_evpn_configure_export_rt_for_vrf(struct bgp *bgp_vrf, struct ecommunity *ecomadd); diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index 1373afec4e..c3cab18d2e 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -2690,14 +2690,6 @@ DEFUN (bgp_evpn_advertise_vni_subnet, if (!bgp_vrf) return CMD_WARNING; - if (!(advertise_type5_routes(bgp_vrf, AFI_IP) || - advertise_type5_routes(bgp_vrf, AFI_IP6))) { - vty_out(vty, - "%%Please enable ip prefix advertisement under l2vpn evpn in %s", - vrf_id_to_name(bgp_vrf->vrf_id)); - return CMD_WARNING; - } - evpn_set_advertise_subnet(bgp, vpn); return CMD_SUCCESS; } @@ -2841,7 +2833,7 @@ DEFUN (no_bgp_evpn_advertise_type5, if (afi == AFI_IP) { - /* if we are already advertising ipv4 prefix as type-5 + /* if we are not advertising ipv4 prefix as type-5 * nothing to do */ if (CHECK_FLAG(bgp_vrf->vrf_flags, @@ -2852,7 +2844,7 @@ DEFUN (no_bgp_evpn_advertise_type5, } } else { - /* if we are already advertising ipv6 prefix as type-5 + /* if we are not advertising ipv6 prefix as type-5 * nothing to do */ if (CHECK_FLAG(bgp_vrf->vrf_flags, diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 20bf9635a3..0d226f9e72 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -2228,10 +2228,10 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn, /* advertise/withdraw type-5 routes */ if ((afi == AFI_IP || afi == AFI_IP6) && (safi == SAFI_UNICAST)) { - if (new_select) + if (advertise_type5_routes(bgp, afi) && new_select) bgp_evpn_advertise_type5_route( bgp, &rn->p, new_select->attr, afi, safi); - else if (old_select) + else if (advertise_type5_routes(bgp, afi) && old_select) bgp_evpn_withdraw_type5_route(bgp, &rn->p, afi, safi); } From 154faa5007767a23eeb1daed8a33421320a9276d Mon Sep 17 00:00:00 2001 From: Mitesh Kanjariya Date: Tue, 20 Feb 2018 00:46:22 -0800 Subject: [PATCH 2/5] bgpd: move l2vpn evpn related flags in struct bgp to af_flags We have af_flags in struct bgp to hold address family related flags, l2vpn evpn flags to indicate advertise ipvX unicast should be moved there. Signed-off-by: Mitesh Kanjariya --- bgpd/bgp_evpn.h | 6 ++++-- bgpd/bgp_evpn_vty.c | 38 +++++++++++++++++++++----------------- bgpd/bgpd.h | 13 ++++++++----- 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/bgpd/bgp_evpn.h b/bgpd/bgp_evpn.h index cd3b7e3af2..064cc71349 100644 --- a/bgpd/bgp_evpn.h +++ b/bgpd/bgp_evpn.h @@ -62,11 +62,13 @@ static inline int advertise_type5_routes(struct bgp *bgp_vrf, return 0; if (afi == AFI_IP && - CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV4_IN_EVPN)) + CHECK_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST)) return 1; if (afi == AFI_IP6 && - CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV6_IN_EVPN)) + CHECK_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST)) return 1; return 0; diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index c3cab18d2e..1720744439 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -2761,21 +2761,23 @@ DEFUN (bgp_evpn_advertise_type5, /* if we are already advertising ipv4 prefix as type-5 * nothing to do */ - if (!rmap_changed && CHECK_FLAG(bgp_vrf->vrf_flags, - BGP_VRF_ADVERTISE_IPV4_IN_EVPN)) + if (!rmap_changed && + CHECK_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST)) return CMD_WARNING; - SET_FLAG(bgp_vrf->vrf_flags, - BGP_VRF_ADVERTISE_IPV4_IN_EVPN); + SET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST); } else { /* if we are already advertising ipv6 prefix as type-5 * nothing to do */ - if (!rmap_changed && CHECK_FLAG(bgp_vrf->vrf_flags, - BGP_VRF_ADVERTISE_IPV6_IN_EVPN)) + if (!rmap_changed && + CHECK_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST)) return CMD_WARNING; - SET_FLAG(bgp_vrf->vrf_flags, - BGP_VRF_ADVERTISE_IPV6_IN_EVPN); + SET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST); } if (rmap_changed) { @@ -2836,22 +2838,22 @@ DEFUN (no_bgp_evpn_advertise_type5, /* if we are not advertising ipv4 prefix as type-5 * nothing to do */ - if (CHECK_FLAG(bgp_vrf->vrf_flags, - BGP_VRF_ADVERTISE_IPV4_IN_EVPN)) { + if (CHECK_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST)) { bgp_evpn_withdraw_type5_routes(bgp_vrf, afi, safi); - UNSET_FLAG(bgp_vrf->vrf_flags, - BGP_VRF_ADVERTISE_IPV4_IN_EVPN); + UNSET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST); } } else { /* if we are not advertising ipv6 prefix as type-5 * nothing to do */ - if (CHECK_FLAG(bgp_vrf->vrf_flags, - BGP_VRF_ADVERTISE_IPV6_IN_EVPN)) { + if (CHECK_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST)) { bgp_evpn_withdraw_type5_routes(bgp_vrf, afi, safi); UNSET_FLAG(bgp_vrf->vrf_flags, - BGP_VRF_ADVERTISE_IPV6_IN_EVPN); + BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST); } } @@ -4373,10 +4375,12 @@ void bgp_config_write_evpn_info(struct vty *vty, struct bgp *bgp, afi_t afi, if (bgp->advertise_gw_macip) vty_out(vty, " advertise-default-gw\n"); - if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_ADVERTISE_IPV4_IN_EVPN)) + if (CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST)) vty_out(vty, " advertise ipv4 unicast\n"); - if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_ADVERTISE_IPV6_IN_EVPN)) + if (CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST)) vty_out(vty, " advertise ipv6 unicast\n"); } diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 220b6d989e..5b77be2be9 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -320,6 +320,11 @@ struct bgp { u_int16_t af_flags[AFI_MAX][SAFI_MAX]; #define BGP_CONFIG_DAMPENING (1 << 0) +/* l2vpn evpn flags */ +#define BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST (1 << 0) +#define BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST (1 << 1) + + /* Route table for next-hop lookup cache. */ struct bgp_table *nexthop_cache_table[AFI_MAX]; @@ -431,11 +436,9 @@ struct bgp { /* vrf flags */ uint32_t vrf_flags; #define BGP_VRF_AUTO (1 << 0) -#define BGP_VRF_ADVERTISE_IPV4_IN_EVPN (1 << 1) -#define BGP_VRF_ADVERTISE_IPV6_IN_EVPN (1 << 2) -#define BGP_VRF_IMPORT_RT_CFGD (1 << 3) -#define BGP_VRF_EXPORT_RT_CFGD (1 << 4) -#define BGP_VRF_RD_CFGD (1 << 5) +#define BGP_VRF_IMPORT_RT_CFGD (1 << 1) +#define BGP_VRF_EXPORT_RT_CFGD (1 << 2) +#define BGP_VRF_RD_CFGD (1 << 3) /* unique ID for auto derivation of RD for this vrf */ uint16_t vrf_rd_id; From 486456ca92b9778e7cb8e0b3524dd7f98bdde8f0 Mon Sep 17 00:00:00 2001 From: Mitesh Kanjariya Date: Thu, 15 Feb 2018 17:20:27 -0800 Subject: [PATCH 3/5] bgpd: support for default-originate type-5 route Implement support for 'default-originate' for L2VPN/EVPN address family. This is needed for the case where external routing within a POD, will follow the default route to the border/exit leaf. The border leaf has more than one next hop to forward the packet on to, depending on the destination IP. Signed-off-by: Mitesh Kanjariya --- ...t-for-default-originate-type-5-route.patch | 180 ++++++++++++++++++ bgpd/bgp_evpn_private.h | 14 ++ bgpd/bgp_evpn_vty.c | 89 +++++++++ bgpd/bgpd.h | 2 + 4 files changed, 285 insertions(+) create mode 100644 0001-bgpd-support-for-default-originate-type-5-route.patch diff --git a/0001-bgpd-support-for-default-originate-type-5-route.patch b/0001-bgpd-support-for-default-originate-type-5-route.patch new file mode 100644 index 0000000000..92121082c0 --- /dev/null +++ b/0001-bgpd-support-for-default-originate-type-5-route.patch @@ -0,0 +1,180 @@ +From dbc3fbc612ce6523a596804c270600de1f6f2309 Mon Sep 17 00:00:00 2001 +From: Mitesh Kanjariya +Date: Thu, 15 Feb 2018 17:20:27 -0800 +Subject: [PATCH] bgpd: support for default-originate type-5 route + +Implement support for 'default-originate' for L2VPN/EVPN address family. +This is needed for the case where external routing within a POD, +will follow the default route to the border/exit leaf. +The border/exit leaf has more than one next hop to forward the packet on to, +depending on the destination IP. + +Signed-off-by: Mitesh Kanjariya +--- + bgpd/bgp_evpn_private.h | 14 ++++++++ + bgpd/bgp_evpn_vty.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++++ + bgpd/bgpd.h | 2 ++ + 3 files changed, 105 insertions(+) + +diff --git a/bgpd/bgp_evpn_private.h b/bgpd/bgp_evpn_private.h +index 5ff16c3..bc68e25 100644 +--- a/bgpd/bgp_evpn_private.h ++++ b/bgpd/bgp_evpn_private.h +@@ -349,6 +349,20 @@ static inline void build_evpn_type3_prefix(struct prefix_evpn *p, + p->prefix.ip.ipaddr_v4 = originator_ip; + } + ++static inline int evpn_default_originate_set(struct bgp *bgp, afi_t afi, ++ safi_t safi) ++{ ++ if (afi == AFI_IP && ++ CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], ++ BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4)) ++ return 1; ++ else if (afi == AFI_IP6 && ++ CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], ++ BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6)) ++ return 1; ++ return 0; ++} ++ + extern void evpn_rt_delete_auto(struct bgp*, vni_t, struct list*); + extern void bgp_evpn_configure_export_rt_for_vrf(struct bgp *bgp_vrf, + struct ecommunity *ecomadd); +diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c +index 1720744..5ce71db 100644 +--- a/bgpd/bgp_evpn_vty.c ++++ b/bgpd/bgp_evpn_vty.c +@@ -2476,6 +2476,48 @@ static void evpn_unset_advertise_default_gw(struct bgp *bgp, + /* + * evpn - enable advertisement of default g/w + */ ++static void evpn_process_default_originate_cmd(struct bgp *bgp_vrf, ++ afi_t afi, int add) ++{ ++ struct prefix ip_prefix; ++ safi_t safi = SAFI_UNICAST; /* ipv4/ipv6 unicast */ ++ ++ /* form the default prefix 0.0.0.0/0 */ ++ memset(&ip_prefix, 0, sizeof(struct prefix)); ++ ip_prefix.family = afi2family(afi); ++ ip_prefix.prefixlen = 0; ++ ++ if (add) { ++ /* bail if we are already advertising default route */ ++ if (evpn_default_originate_set(bgp_vrf, afi, safi)) ++ return; ++ ++ if (afi == AFI_IP) ++ SET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], ++ BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4); ++ else if (afi == AFI_IP6) ++ SET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], ++ BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6); ++ bgp_evpn_advertise_type5_route(bgp_vrf, &ip_prefix, ++ NULL, afi, safi); ++ } else { ++ /* bail out if we havent advertised the default route */ ++ if (!evpn_default_originate_set(bgp_vrf, afi, safi)) ++ return; ++ if (afi == AFI_IP) ++ UNSET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], ++ BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4); ++ else if (afi == AFI_IP6) ++ UNSET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], ++ BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6); ++ bgp_evpn_withdraw_type5_route(bgp_vrf, &ip_prefix, ++ afi, safi); ++ } ++} ++ ++/* ++ * evpn - enable advertisement of default g/w ++ */ + static void evpn_set_advertise_subnet(struct bgp *bgp, + struct bgpevpn *vpn) + { +@@ -2671,6 +2713,43 @@ DEFUN (no_bgp_evpn_advertise_all_vni, + return CMD_SUCCESS; + } + ++DEFUN (bgp_evpn_default_originate, ++ bgp_evpn_default_originate_cmd, ++ "default-originate ", ++ "originate a default route\n" ++ "ipv4 address family\n" ++ "ipv6 address family\n") ++{ ++ afi_t afi = 0; ++ int idx_afi = 0; ++ struct bgp *bgp_vrf = VTY_GET_CONTEXT(bgp); ++ ++ if (!bgp_vrf) ++ return CMD_WARNING; ++ argv_find_and_parse_afi(argv, argc, &idx_afi, &afi); ++ evpn_process_default_originate_cmd(bgp_vrf, afi, 1); ++ return CMD_SUCCESS; ++} ++ ++DEFUN (no_bgp_evpn_default_originate, ++ no_bgp_evpn_default_originate_cmd, ++ "no default-originate ", ++ NO_STR ++ "withdraw a default route\n" ++ "ipv4 address family\n" ++ "ipv6 address family\n") ++{ ++ afi_t afi = 0; ++ int idx_afi = 0; ++ struct bgp *bgp_vrf = VTY_GET_CONTEXT(bgp); ++ ++ if (!bgp_vrf) ++ return CMD_WARNING; ++ argv_find_and_parse_afi(argv, argc, &idx_afi, &afi); ++ evpn_process_default_originate_cmd(bgp_vrf, afi, 0); ++ return CMD_SUCCESS; ++} ++ + DEFUN (bgp_evpn_advertise_vni_subnet, + bgp_evpn_advertise_vni_subnet_cmd, + "advertise-subnet", +@@ -4382,6 +4461,14 @@ void bgp_config_write_evpn_info(struct vty *vty, struct bgp *bgp, afi_t afi, + if (CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST)) + vty_out(vty, " advertise ipv6 unicast\n"); ++ ++ if (CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], ++ BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4)) ++ vty_out(vty, " default-originate ipv4\n"); ++ ++ if (CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], ++ BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6)) ++ vty_out(vty, " default-originate ipv6\n"); + } + + void bgp_ethernetvpn_init(void) +@@ -4411,6 +4498,8 @@ void bgp_ethernetvpn_init(void) + install_element(BGP_EVPN_NODE, &no_bgp_evpn_advertise_default_gw_cmd); + install_element(BGP_EVPN_NODE, &bgp_evpn_advertise_type5_cmd); + install_element(BGP_EVPN_NODE, &no_bgp_evpn_advertise_type5_cmd); ++ install_element(BGP_EVPN_NODE, &bgp_evpn_default_originate_cmd); ++ install_element(BGP_EVPN_NODE, &no_bgp_evpn_default_originate_cmd); + + /* "show bgp l2vpn evpn" commands. */ + install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_vni_cmd); +diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h +index 5b77be2..274ca82 100644 +--- a/bgpd/bgpd.h ++++ b/bgpd/bgpd.h +@@ -323,6 +323,8 @@ struct bgp { + /* l2vpn evpn flags */ + #define BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST (1 << 0) + #define BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST (1 << 1) ++#define BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4 (1 << 2) ++#define BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6 (1 << 3) + + + /* Route table for next-hop lookup cache. */ +-- +2.7.4 + diff --git a/bgpd/bgp_evpn_private.h b/bgpd/bgp_evpn_private.h index 5ff16c39e9..bc68e259b6 100644 --- a/bgpd/bgp_evpn_private.h +++ b/bgpd/bgp_evpn_private.h @@ -349,6 +349,20 @@ static inline void build_evpn_type3_prefix(struct prefix_evpn *p, p->prefix.ip.ipaddr_v4 = originator_ip; } +static inline int evpn_default_originate_set(struct bgp *bgp, afi_t afi, + safi_t safi) +{ + if (afi == AFI_IP && + CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4)) + return 1; + else if (afi == AFI_IP6 && + CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6)) + return 1; + return 0; +} + extern void evpn_rt_delete_auto(struct bgp*, vni_t, struct list*); extern void bgp_evpn_configure_export_rt_for_vrf(struct bgp *bgp_vrf, struct ecommunity *ecomadd); diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index 1720744439..5ce71dbf62 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -2473,6 +2473,48 @@ static void evpn_unset_advertise_default_gw(struct bgp *bgp, return; } +/* + * evpn - enable advertisement of default g/w + */ +static void evpn_process_default_originate_cmd(struct bgp *bgp_vrf, + afi_t afi, int add) +{ + struct prefix ip_prefix; + safi_t safi = SAFI_UNICAST; /* ipv4/ipv6 unicast */ + + /* form the default prefix 0.0.0.0/0 */ + memset(&ip_prefix, 0, sizeof(struct prefix)); + ip_prefix.family = afi2family(afi); + ip_prefix.prefixlen = 0; + + if (add) { + /* bail if we are already advertising default route */ + if (evpn_default_originate_set(bgp_vrf, afi, safi)) + return; + + if (afi == AFI_IP) + SET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4); + else if (afi == AFI_IP6) + SET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6); + bgp_evpn_advertise_type5_route(bgp_vrf, &ip_prefix, + NULL, afi, safi); + } else { + /* bail out if we havent advertised the default route */ + if (!evpn_default_originate_set(bgp_vrf, afi, safi)) + return; + if (afi == AFI_IP) + UNSET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4); + else if (afi == AFI_IP6) + UNSET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6); + bgp_evpn_withdraw_type5_route(bgp_vrf, &ip_prefix, + afi, safi); + } +} + /* * evpn - enable advertisement of default g/w */ @@ -2671,6 +2713,43 @@ DEFUN (no_bgp_evpn_advertise_all_vni, return CMD_SUCCESS; } +DEFUN (bgp_evpn_default_originate, + bgp_evpn_default_originate_cmd, + "default-originate ", + "originate a default route\n" + "ipv4 address family\n" + "ipv6 address family\n") +{ + afi_t afi = 0; + int idx_afi = 0; + struct bgp *bgp_vrf = VTY_GET_CONTEXT(bgp); + + if (!bgp_vrf) + return CMD_WARNING; + argv_find_and_parse_afi(argv, argc, &idx_afi, &afi); + evpn_process_default_originate_cmd(bgp_vrf, afi, 1); + return CMD_SUCCESS; +} + +DEFUN (no_bgp_evpn_default_originate, + no_bgp_evpn_default_originate_cmd, + "no default-originate ", + NO_STR + "withdraw a default route\n" + "ipv4 address family\n" + "ipv6 address family\n") +{ + afi_t afi = 0; + int idx_afi = 0; + struct bgp *bgp_vrf = VTY_GET_CONTEXT(bgp); + + if (!bgp_vrf) + return CMD_WARNING; + argv_find_and_parse_afi(argv, argc, &idx_afi, &afi); + evpn_process_default_originate_cmd(bgp_vrf, afi, 0); + return CMD_SUCCESS; +} + DEFUN (bgp_evpn_advertise_vni_subnet, bgp_evpn_advertise_vni_subnet_cmd, "advertise-subnet", @@ -4382,6 +4461,14 @@ void bgp_config_write_evpn_info(struct vty *vty, struct bgp *bgp, afi_t afi, if (CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST)) vty_out(vty, " advertise ipv6 unicast\n"); + + if (CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4)) + vty_out(vty, " default-originate ipv4\n"); + + if (CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6)) + vty_out(vty, " default-originate ipv6\n"); } void bgp_ethernetvpn_init(void) @@ -4411,6 +4498,8 @@ void bgp_ethernetvpn_init(void) install_element(BGP_EVPN_NODE, &no_bgp_evpn_advertise_default_gw_cmd); install_element(BGP_EVPN_NODE, &bgp_evpn_advertise_type5_cmd); install_element(BGP_EVPN_NODE, &no_bgp_evpn_advertise_type5_cmd); + install_element(BGP_EVPN_NODE, &bgp_evpn_default_originate_cmd); + install_element(BGP_EVPN_NODE, &no_bgp_evpn_default_originate_cmd); /* "show bgp l2vpn evpn" commands. */ install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_vni_cmd); diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 5b77be2be9..274ca82ffc 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -323,6 +323,8 @@ struct bgp { /* l2vpn evpn flags */ #define BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST (1 << 0) #define BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST (1 << 1) +#define BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4 (1 << 2) +#define BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6 (1 << 3) /* Route table for next-hop lookup cache. */ From 6fb219da876ace4732e31005466cae708e512d42 Mon Sep 17 00:00:00 2001 From: Mitesh Kanjariya Date: Wed, 21 Feb 2018 22:02:07 -0800 Subject: [PATCH 4/5] bgpd: provide a match clause to match EVPN default route A Border Leaf can originate a default route for all the leafs within the POD. However, we do not want to advertise this route outside the POD. Therefore, we provide an option to filter a EVPN type5 default route through a route-map. Signed-off-by: Mitesh Kanjariya --- ...t-for-default-originate-type-5-route.patch | 180 ------------------ bgpd/bgp_evpn_private.h | 8 + bgpd/bgp_routemap.c | 44 +++++ 3 files changed, 52 insertions(+), 180 deletions(-) delete mode 100644 0001-bgpd-support-for-default-originate-type-5-route.patch diff --git a/0001-bgpd-support-for-default-originate-type-5-route.patch b/0001-bgpd-support-for-default-originate-type-5-route.patch deleted file mode 100644 index 92121082c0..0000000000 --- a/0001-bgpd-support-for-default-originate-type-5-route.patch +++ /dev/null @@ -1,180 +0,0 @@ -From dbc3fbc612ce6523a596804c270600de1f6f2309 Mon Sep 17 00:00:00 2001 -From: Mitesh Kanjariya -Date: Thu, 15 Feb 2018 17:20:27 -0800 -Subject: [PATCH] bgpd: support for default-originate type-5 route - -Implement support for 'default-originate' for L2VPN/EVPN address family. -This is needed for the case where external routing within a POD, -will follow the default route to the border/exit leaf. -The border/exit leaf has more than one next hop to forward the packet on to, -depending on the destination IP. - -Signed-off-by: Mitesh Kanjariya ---- - bgpd/bgp_evpn_private.h | 14 ++++++++ - bgpd/bgp_evpn_vty.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++++ - bgpd/bgpd.h | 2 ++ - 3 files changed, 105 insertions(+) - -diff --git a/bgpd/bgp_evpn_private.h b/bgpd/bgp_evpn_private.h -index 5ff16c3..bc68e25 100644 ---- a/bgpd/bgp_evpn_private.h -+++ b/bgpd/bgp_evpn_private.h -@@ -349,6 +349,20 @@ static inline void build_evpn_type3_prefix(struct prefix_evpn *p, - p->prefix.ip.ipaddr_v4 = originator_ip; - } - -+static inline int evpn_default_originate_set(struct bgp *bgp, afi_t afi, -+ safi_t safi) -+{ -+ if (afi == AFI_IP && -+ CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], -+ BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4)) -+ return 1; -+ else if (afi == AFI_IP6 && -+ CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], -+ BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6)) -+ return 1; -+ return 0; -+} -+ - extern void evpn_rt_delete_auto(struct bgp*, vni_t, struct list*); - extern void bgp_evpn_configure_export_rt_for_vrf(struct bgp *bgp_vrf, - struct ecommunity *ecomadd); -diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c -index 1720744..5ce71db 100644 ---- a/bgpd/bgp_evpn_vty.c -+++ b/bgpd/bgp_evpn_vty.c -@@ -2476,6 +2476,48 @@ static void evpn_unset_advertise_default_gw(struct bgp *bgp, - /* - * evpn - enable advertisement of default g/w - */ -+static void evpn_process_default_originate_cmd(struct bgp *bgp_vrf, -+ afi_t afi, int add) -+{ -+ struct prefix ip_prefix; -+ safi_t safi = SAFI_UNICAST; /* ipv4/ipv6 unicast */ -+ -+ /* form the default prefix 0.0.0.0/0 */ -+ memset(&ip_prefix, 0, sizeof(struct prefix)); -+ ip_prefix.family = afi2family(afi); -+ ip_prefix.prefixlen = 0; -+ -+ if (add) { -+ /* bail if we are already advertising default route */ -+ if (evpn_default_originate_set(bgp_vrf, afi, safi)) -+ return; -+ -+ if (afi == AFI_IP) -+ SET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], -+ BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4); -+ else if (afi == AFI_IP6) -+ SET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], -+ BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6); -+ bgp_evpn_advertise_type5_route(bgp_vrf, &ip_prefix, -+ NULL, afi, safi); -+ } else { -+ /* bail out if we havent advertised the default route */ -+ if (!evpn_default_originate_set(bgp_vrf, afi, safi)) -+ return; -+ if (afi == AFI_IP) -+ UNSET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], -+ BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4); -+ else if (afi == AFI_IP6) -+ UNSET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], -+ BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6); -+ bgp_evpn_withdraw_type5_route(bgp_vrf, &ip_prefix, -+ afi, safi); -+ } -+} -+ -+/* -+ * evpn - enable advertisement of default g/w -+ */ - static void evpn_set_advertise_subnet(struct bgp *bgp, - struct bgpevpn *vpn) - { -@@ -2671,6 +2713,43 @@ DEFUN (no_bgp_evpn_advertise_all_vni, - return CMD_SUCCESS; - } - -+DEFUN (bgp_evpn_default_originate, -+ bgp_evpn_default_originate_cmd, -+ "default-originate ", -+ "originate a default route\n" -+ "ipv4 address family\n" -+ "ipv6 address family\n") -+{ -+ afi_t afi = 0; -+ int idx_afi = 0; -+ struct bgp *bgp_vrf = VTY_GET_CONTEXT(bgp); -+ -+ if (!bgp_vrf) -+ return CMD_WARNING; -+ argv_find_and_parse_afi(argv, argc, &idx_afi, &afi); -+ evpn_process_default_originate_cmd(bgp_vrf, afi, 1); -+ return CMD_SUCCESS; -+} -+ -+DEFUN (no_bgp_evpn_default_originate, -+ no_bgp_evpn_default_originate_cmd, -+ "no default-originate ", -+ NO_STR -+ "withdraw a default route\n" -+ "ipv4 address family\n" -+ "ipv6 address family\n") -+{ -+ afi_t afi = 0; -+ int idx_afi = 0; -+ struct bgp *bgp_vrf = VTY_GET_CONTEXT(bgp); -+ -+ if (!bgp_vrf) -+ return CMD_WARNING; -+ argv_find_and_parse_afi(argv, argc, &idx_afi, &afi); -+ evpn_process_default_originate_cmd(bgp_vrf, afi, 0); -+ return CMD_SUCCESS; -+} -+ - DEFUN (bgp_evpn_advertise_vni_subnet, - bgp_evpn_advertise_vni_subnet_cmd, - "advertise-subnet", -@@ -4382,6 +4461,14 @@ void bgp_config_write_evpn_info(struct vty *vty, struct bgp *bgp, afi_t afi, - if (CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], - BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST)) - vty_out(vty, " advertise ipv6 unicast\n"); -+ -+ if (CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], -+ BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4)) -+ vty_out(vty, " default-originate ipv4\n"); -+ -+ if (CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], -+ BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6)) -+ vty_out(vty, " default-originate ipv6\n"); - } - - void bgp_ethernetvpn_init(void) -@@ -4411,6 +4498,8 @@ void bgp_ethernetvpn_init(void) - install_element(BGP_EVPN_NODE, &no_bgp_evpn_advertise_default_gw_cmd); - install_element(BGP_EVPN_NODE, &bgp_evpn_advertise_type5_cmd); - install_element(BGP_EVPN_NODE, &no_bgp_evpn_advertise_type5_cmd); -+ install_element(BGP_EVPN_NODE, &bgp_evpn_default_originate_cmd); -+ install_element(BGP_EVPN_NODE, &no_bgp_evpn_default_originate_cmd); - - /* "show bgp l2vpn evpn" commands. */ - install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_vni_cmd); -diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h -index 5b77be2..274ca82 100644 ---- a/bgpd/bgpd.h -+++ b/bgpd/bgpd.h -@@ -323,6 +323,8 @@ struct bgp { - /* l2vpn evpn flags */ - #define BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST (1 << 0) - #define BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST (1 << 1) -+#define BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4 (1 << 2) -+#define BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6 (1 << 3) - - - /* Route table for next-hop lookup cache. */ --- -2.7.4 - diff --git a/bgpd/bgp_evpn_private.h b/bgpd/bgp_evpn_private.h index bc68e259b6..4b2742058b 100644 --- a/bgpd/bgp_evpn_private.h +++ b/bgpd/bgp_evpn_private.h @@ -280,6 +280,14 @@ static inline void ip_prefix_from_type5_prefix(struct prefix_evpn *evp, } } +static inline int is_evpn_prefix_default(struct prefix *evp) +{ + if (evp->family != AF_EVPN) + return 0; + + return ((evp->u.prefix_evpn.ip_prefix_length == 0) ? 1 : 0); +} + static inline void ip_prefix_from_type2_prefix(struct prefix_evpn *evp, struct prefix *ip) { diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 4d5624d3b0..b3cd4b7af7 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -594,6 +594,24 @@ struct route_map_rule_cmd route_match_ip_route_source_prefix_list_cmd = { route_match_ip_route_source_prefix_list_compile, route_match_ip_route_source_prefix_list_free}; +/* `match evpn default-route' */ + +/* Match function should return 1 if match is success else 0 */ +static route_map_result_t route_match_evpn_default_route(void *rule, + struct prefix *p, + route_map_object_t + type, void *object) +{ + if (type == RMAP_BGP && is_evpn_prefix_default(p)) + return RMAP_MATCH; + + return RMAP_NOMATCH; +} + +/* Route map commands for default-route matching. */ +struct route_map_rule_cmd route_match_evpn_default_route_cmd = { + "evpn default-route", route_match_evpn_default_route, NULL, NULL}; + /* `match mac address MAC_ACCESS_LIST' */ /* Match function should return 1 if match is success else return @@ -3249,6 +3267,29 @@ DEFUN (no_match_evpn_vni, RMAP_EVENT_MATCH_DELETED); } +DEFUN (match_evpn_default_route, + match_evpn_default_route_cmd, + "match evpn default-route", + MATCH_STR + EVPN_HELP_STR + "default EVPN type-5 route\n") +{ + return bgp_route_match_add(vty, "evpn default-route", NULL, + RMAP_EVENT_MATCH_ADDED); +} + +DEFUN (no_match_evpn_default_route, + no_match_evpn_default_route_cmd, + "no match evpn default-route", + NO_STR + MATCH_STR + EVPN_HELP_STR + "default EVPN type-5 route\n") +{ + return bgp_route_match_delete(vty, "evpn default-route", NULL, + RMAP_EVENT_MATCH_DELETED); +} + DEFUN (match_peer, match_peer_cmd, "match peer ", @@ -4628,6 +4669,7 @@ void bgp_route_map_init(void) route_map_install_match(&route_match_mac_address_cmd); route_map_install_match(&route_match_evpn_vni_cmd); route_map_install_match(&route_match_evpn_route_type_cmd); + route_map_install_match(&route_match_evpn_default_route_cmd); route_map_install_set(&route_set_ip_nexthop_cmd); route_map_install_set(&route_set_local_pref_cmd); @@ -4664,6 +4706,8 @@ void bgp_route_map_init(void) install_element(RMAP_NODE, &no_match_evpn_vni_cmd); install_element(RMAP_NODE, &match_evpn_route_type_cmd); install_element(RMAP_NODE, &no_match_evpn_route_type_cmd); + install_element(RMAP_NODE, &match_evpn_default_route_cmd); + install_element(RMAP_NODE, &no_match_evpn_default_route_cmd); install_element(RMAP_NODE, &match_aspath_cmd); install_element(RMAP_NODE, &no_match_aspath_cmd); From 2c29b18a1b327beaddabc11fd8e062310625b574 Mon Sep 17 00:00:00 2001 From: mitesh Date: Tue, 27 Feb 2018 02:19:57 -0800 Subject: [PATCH 5/5] bgpd: reassign the flags in struct bgp af_flags to avoid conflict We have af_flags in struct bgp which holds address family related flags. Seems like we had a conflict between two flags. Signed-off-by: Mitesh Kanjariya --- bgpd/bgpd.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index bc5350ce24..43d76e5273 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -320,11 +320,11 @@ struct bgp { u_int16_t af_flags[AFI_MAX][SAFI_MAX]; #define BGP_CONFIG_DAMPENING (1 << 0) -/* l2vpn evpn flags */ -#define BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST (1 << 0) -#define BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST (1 << 1) -#define BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4 (1 << 2) -#define BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6 (1 << 3) +/* l2vpn evpn flags - 1 << 0 is used for DAMPENNG */ +#define BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST (1 << 1) +#define BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST (1 << 2) +#define BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4 (1 << 3) +#define BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6 (1 << 4) /* Route table for next-hop lookup cache. */