]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_zebra.c
Merge pull request #3176 from chiragshah6/evpn_dev
[mirror_frr.git] / bgpd / bgp_zebra.c
index f9f9e693dc01bc02882a35ccdf04584617396063..1e0abaa29e94d8f99775beca0275d2d24bafd991 100644 (file)
@@ -58,6 +58,7 @@
 #include "bgpd/bgp_mplsvpn.h"
 #include "bgpd/bgp_labelpool.h"
 #include "bgpd/bgp_pbr.h"
+#include "bgpd/bgp_evpn_private.h"
 
 /* All information about zebra. */
 struct zclient *zclient = NULL;
@@ -1999,6 +2000,42 @@ int bgp_zebra_advertise_all_vni(struct bgp *bgp, int advertise)
        return zclient_send_message(zclient);
 }
 
+int bgp_zebra_dup_addr_detection(struct bgp *bgp)
+{
+       struct stream *s;
+
+       /* Check socket. */
+       if (!zclient || zclient->sock < 0)
+               return 0;
+
+       /* Don't try to register if Zebra doesn't know of this instance. */
+       if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp))
+               return 0;
+
+       if (BGP_DEBUG(zebra, ZEBRA))
+               zlog_debug("dup addr detect %s max_moves %u time %u freeze %s freeze_time %u",
+                          bgp->evpn_info->dup_addr_detect ?
+                          "enable" : "disable",
+                          bgp->evpn_info->dad_max_moves,
+                          bgp->evpn_info->dad_time,
+                          bgp->evpn_info->dad_freeze ?
+                          "enable" : "disable",
+                          bgp->evpn_info->dad_freeze_time);
+
+       s = zclient->obuf;
+       stream_reset(s);
+       zclient_create_header(s, ZEBRA_DUPLICATE_ADDR_DETECTION,
+                             bgp->vrf_id);
+       stream_putl(s, bgp->evpn_info->dup_addr_detect);
+       stream_putl(s, bgp->evpn_info->dad_time);
+       stream_putl(s, bgp->evpn_info->dad_max_moves);
+       stream_putl(s, bgp->evpn_info->dad_freeze);
+       stream_putl(s, bgp->evpn_info->dad_freeze_time);
+       stream_putw_at(s, 0, stream_get_endp(s));
+
+       return zclient_send_message(zclient);
+}
+
 static int rule_notify_owner(int command, struct zclient *zclient,
                             zebra_size_t length, vrf_id_t vrf_id)
 {