]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_zebra.c
Merge pull request #3448 from chiragshah6/evpn_dev1
[mirror_frr.git] / bgpd / bgp_zebra.c
index f9f9e693dc01bc02882a35ccdf04584617396063..66d33337395b49b0dfe02537fc7cae9cfc4c7d10 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;
@@ -1481,7 +1482,7 @@ void bgp_zebra_announce_table(struct bgp *bgp, afi_t afi, safi_t safi)
                return;
 
        for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn))
-               for (pi = rn->info; pi; pi = pi->next)
+               for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next)
                        if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED) &&
 
                            (pi->type == ZEBRA_ROUTE_BGP
@@ -1693,7 +1694,7 @@ int bgp_redistribute_metric_set(struct bgp *bgp, struct bgp_redist *red,
 
        for (rn = bgp_table_top(bgp->rib[afi][SAFI_UNICAST]); rn;
             rn = bgp_route_next(rn)) {
-               for (pi = rn->info; pi; pi = pi->next) {
+               for (pi = bgp_node_get_bgp_path_info(rn); pi; pi = pi->next) {
                        if (pi->sub_type == BGP_ROUTE_REDISTRIBUTE
                            && pi->type == type
                            && pi->instance == red->instance) {
@@ -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)
 {