]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: dup addr detect data struct for cfg
authorChirag Shah <chirag@cumulusnetworks.com>
Wed, 31 Oct 2018 23:53:28 +0000 (16:53 -0700)
committerChirag Shah <chirag@cumulusnetworks.com>
Sun, 18 Nov 2018 03:22:16 +0000 (19:22 -0800)
Enable/disable duplicate address detection
there are 3 actions
warning-only: Default action which generates
only frr warning (syslog) to user for any
duplicate detecton
freeze: Permanently freezes address, manual
intervene required.
freeze with time: An address will recover once
the time has expired (auto-recovery).

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
bgpd/bgp_evpn.c
bgpd/bgp_evpn_private.h
bgpd/bgpd.c
bgpd/bgpd.h

index fc3ac287235aaa0be8991341c222430f781d9a40..b3a498bf575c292f71752ab7e0827cf1a8319566 100644 (file)
@@ -5802,6 +5802,19 @@ void bgp_evpn_init(struct bgp *bgp)
        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;
+       }
 
        /* Default BUM handling is to do head-end replication. */
        bgp->vxlan_flood_ctrl = VXLAN_FLOOD_HEAD_END_REPL;
index f0017f3533fac2d7f57edc1b752040e1978a48f4..b2f16fc28435c895aa37e9bdcec222d53b76d561 100644 (file)
@@ -161,6 +161,24 @@ struct vrf_irt_node {
 #define RT_TYPE_EXPORT 2
 #define RT_TYPE_BOTH   3
 
+#define EVPN_DAD_DEFAULT_TIME 180 /* secs */
+#define EVPN_DAD_DEFAULT_MAX_MOVES 5 /* default from RFC 7432 */
+#define EVPN_DAD_DEFAULT_AUTO_RECOVERY_TIME 1800 /* secs */
+
+struct bgp_evpn_info {
+       /* enable disable dup detect */
+       bool dup_addr_detect;
+
+       /* Detection time(M) */
+       int dad_time;
+       /* Detection max moves(N) */
+       uint32_t dad_max_moves;
+       /* Permanent freeze */
+       bool dad_freeze;
+       /* Recovery time */
+       uint32_t dad_freeze_time;
+};
+
 static inline int is_vrf_rd_configured(struct bgp *bgp_vrf)
 {
        return (CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_RD_CFGD));
index a078c4f58743b8c7065f241556709a109941cc7e..7ff0dae200c233580cf1e20c0e363ece48aa22e8 100644 (file)
 #include "bgpd/bgp_labelpool.h"
 #include "bgpd/bgp_pbr.h"
 #include "bgpd/bgp_addpath.h"
+#include "bgpd/bgp_evpn_private.h"
 
 DEFINE_MTYPE_STATIC(BGPD, PEER_TX_SHUTDOWN_MSG, "Peer shutdown message (TX)");
+DEFINE_MTYPE_STATIC(BGPD, BGP_EVPN_INFO, "BGP EVPN instance information");
 DEFINE_QOBJ_TYPE(bgp_master)
 DEFINE_QOBJ_TYPE(bgp)
 DEFINE_QOBJ_TYPE(peer)
@@ -2952,6 +2954,9 @@ static struct bgp *bgp_create(as_t *as, const char *name,
        /* assign a unique rd id for auto derivation of vrf's RD */
        bf_assign_index(bm->rd_idspace, bgp->vrf_rd_id);
 
+       bgp->evpn_info = XCALLOC(MTYPE_BGP_EVPN_INFO,
+                                sizeof(struct bgp_evpn_info));
+
        bgp_evpn_init(bgp);
        bgp_pbr_init(bgp);
        return bgp;
@@ -3343,6 +3348,7 @@ void bgp_free(struct bgp *bgp)
 
        bgp_evpn_cleanup(bgp);
        bgp_pbr_cleanup(bgp);
+       XFREE(MTYPE_BGP_EVPN_INFO, bgp->evpn_info);
 
        for (afi = AFI_IP; afi < AFI_MAX; afi++) {
                vpn_policy_direction_t dir;
index 70193104b41b30dc85aaa273d1a1ac2acf1e17a1..216113dc6781585cc77ea1d113a78625ffae78c3 100644 (file)
@@ -482,6 +482,8 @@ struct bgp {
        /* EVPN enable - advertise local VNIs and their MACs etc. */
        int advertise_all_vni;
 
+       struct bgp_evpn_info *evpn_info;
+
        /* EVPN - use RFC 8365 to auto-derive RT */
        int advertise_autort_rfc8365;