#include "bgpd/bgp_aspath.h"
#include "bgpd/bgp_zebra.h"
#include "bgpd/bgp_nexthop.h"
+#include "bgpd/bgp_addpath.h"
/*
* Definitions and external declarations.
&& old_select->sub_type == BGP_ROUTE_IMPORTED
&& !CHECK_FLAG(rn->flags, BGP_NODE_USER_CLEAR)
&& !CHECK_FLAG(old_select->flags, BGP_PATH_ATTR_CHANGED)
- && !bgp->addpath_tx_used[afi][safi]) {
+ && !bgp_addpath_is_addpath_used(&bgp->tx_addpath, afi, safi)) {
if (bgp_zebra_has_route_changed(rn, old_select)) {
ret = evpn_es_install_vtep(bgp, es,
(struct prefix_evpn *)&rn->p,
&& old_select->sub_type == BGP_ROUTE_IMPORTED
&& !CHECK_FLAG(rn->flags, BGP_NODE_USER_CLEAR)
&& !CHECK_FLAG(old_select->flags, BGP_PATH_ATTR_CHANGED)
- && !bgp->addpath_tx_used[afi][safi]) {
+ && !bgp_addpath_is_addpath_used(&bgp->tx_addpath, afi, safi)) {
if (bgp_zebra_has_route_changed(rn, old_select)) {
if (old_select->attr->sticky)
SET_FLAG(flags, ZEBRA_MACIP_TYPE_STICKY);
*/
static void delete_withdraw_vrf_routes(struct bgp *bgp_vrf)
{
+ /* Delete ipv4 default route and withdraw from peers */
+ if (evpn_default_originate_set(bgp_vrf, AFI_IP, SAFI_UNICAST))
+ bgp_evpn_install_uninstall_default_route(bgp_vrf, AFI_IP,
+ SAFI_UNICAST, false);
+
/* delete all ipv4 routes and withdraw from peers */
if (advertise_type5_routes(bgp_vrf, AFI_IP))
bgp_evpn_withdraw_type5_routes(bgp_vrf, AFI_IP, SAFI_UNICAST);
+ /* Delete ipv6 default route and withdraw from peers */
+ if (evpn_default_originate_set(bgp_vrf, AFI_IP6, SAFI_UNICAST))
+ bgp_evpn_install_uninstall_default_route(bgp_vrf, AFI_IP6,
+ SAFI_UNICAST, false);
+
/* delete all ipv6 routes and withdraw from peers */
if (advertise_type5_routes(bgp_vrf, AFI_IP6))
bgp_evpn_withdraw_type5_routes(bgp_vrf, AFI_IP6, SAFI_UNICAST);
if (advertise_type5_routes(bgp_vrf, AFI_IP))
bgp_evpn_advertise_type5_routes(bgp_vrf, AFI_IP, SAFI_UNICAST);
+ /* update ipv4 default route and withdraw from peers */
+ if (evpn_default_originate_set(bgp_vrf, AFI_IP, SAFI_UNICAST))
+ bgp_evpn_install_uninstall_default_route(bgp_vrf, AFI_IP,
+ SAFI_UNICAST, true);
+
/* update all ipv6 routes */
if (advertise_type5_routes(bgp_vrf, AFI_IP6))
bgp_evpn_advertise_type5_routes(bgp_vrf, AFI_IP6, SAFI_UNICAST);
+
+ /* update ipv6 default route and withdraw from peers */
+ if (evpn_default_originate_set(bgp_vrf, AFI_IP6, SAFI_UNICAST))
+ bgp_evpn_install_uninstall_default_route(bgp_vrf, AFI_IP6,
+ SAFI_UNICAST, true);
+
}
/*
}
}
+/*
+ * evpn - enable advertisement of default g/w
+ */
+void bgp_evpn_install_uninstall_default_route(struct bgp *bgp_vrf, afi_t afi,
+ safi_t safi, bool add)
+{
+ struct prefix ip_prefix;
+
+ /* form the default prefix 0.0.0.0/0 */
+ memset(&ip_prefix, 0, sizeof(struct prefix));
+ ip_prefix.family = afi2family(afi);
+
+ if (add) {
+ bgp_evpn_advertise_type5_route(bgp_vrf, &ip_prefix,
+ NULL, afi, safi);
+ } else {
+ bgp_evpn_withdraw_type5_route(bgp_vrf, &ip_prefix,
+ afi, safi);
+ }
+}
+
+
/*
* Advertise IP prefix as type-5 route. The afi/safi and src_attr passed
* to this function correspond to those of the source IP prefix (best
bgp->vrf_export_rtl->del = evpn_xxport_delete_ecomm;
bgp->l2vnis = list_new();
bgp->l2vnis->cmp = vni_list_cmp;
+ /* By default Duplicate Address Dection is enabled.
+ * Max-moves (N) 5, detection time (M) 180
+ * default action is warning-only
+ * freeze action permanently freezes address,
+ * and freeze time (auto-recovery) is disabled.
+ */
+ if (bgp->evpn_info) {
+ bgp->evpn_info->dup_addr_detect = true;
+ bgp->evpn_info->dad_time = EVPN_DAD_DEFAULT_TIME;
+ bgp->evpn_info->dad_max_moves = EVPN_DAD_DEFAULT_MAX_MOVES;
+ bgp->evpn_info->dad_freeze = false;
+ bgp->evpn_info->dad_freeze_time = 0;
+ /* Initialize zebra vxlan */
+ bgp_zebra_dup_addr_detection(bgp);
+ }
/* Default BUM handling is to do head-end replication. */
bgp->vxlan_flood_ctrl = VXLAN_FLOOD_HEAD_END_REPL;