]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge pull request #1455 from mkanjari/evpn-symmetric-routing
authorPhilippe Guibert <philippe.guibert@6wind.com>
Fri, 12 Jan 2018 07:27:37 +0000 (08:27 +0100)
committerGitHub <noreply@github.com>
Fri, 12 Jan 2018 07:27:37 +0000 (08:27 +0100)
Support for Evpn symmetric routing + EVPN Prefix route

1  2 
bgpd/bgpd.c

diff --combined bgpd/bgpd.c
index 188da7014dfb752d55e55d8301d037ce47fbbfe0,0947c85fcf31533bc184da4ae6afb1304940b611..5356cfd2fc9f22fbf99cd9f7520df780c264ce8b
@@@ -79,7 -79,7 +79,7 @@@
  #include "bgpd/bgp_evpn_vty.h"
  #include "bgpd/bgp_keepalives.h"
  #include "bgpd/bgp_io.h"
+ #include "bgpd/bgp_ecommunity.h"
  
  DEFINE_MTYPE_STATIC(BGPD, PEER_TX_SHUTDOWN_MSG, "Peer shutdown message (TX)");
  DEFINE_QOBJ_TYPE(bgp_master)
@@@ -218,7 -218,7 +218,7 @@@ static int bgp_router_id_set(struct bg
                return 0;
  
        /* EVPN uses router id in RD, withdraw them */
-       if (bgp->advertise_all_vni)
+       if (is_evpn_enabled())
                bgp_evpn_handle_router_id_update(bgp, TRUE);
  
        IPV4_ADDR_COPY(&bgp->router_id, id);
        }
  
        /* EVPN uses router id in RD, update them */
-       if (bgp->advertise_all_vni)
+       if (is_evpn_enabled())
                bgp_evpn_handle_router_id_update(bgp, FALSE);
  
        return 0;
@@@ -1151,13 -1151,15 +1151,13 @@@ struct peer *peer_new(struct bgp *bgp
         * - We RX a BGP_UPDATE where the attributes alone are just
         *   under BGP_MAX_PACKET_SIZE
         * - The user configures an outbound route-map that does many as-path
 -       *   prepends or adds many communities.  At most they can have
 -       * CMD_ARGC_MAX
 -       *   args in a route-map so there is a finite limit on how large they
 -       * can
 -       *   make the attributes.
 +       *   prepends or adds many communities. At most they can have
 +       *   CMD_ARGC_MAX args in a route-map so there is a finite limit on how
 +       *   large they can make the attributes.
         *
         * Having a buffer with BGP_MAX_PACKET_SIZE_OVERFLOW allows us to avoid
 -       * bounds
 -       * checking for every single attribute as we construct an UPDATE.
 +       * bounds checking for every single attribute as we construct an
 +       * UPDATE.
         */
        peer->obuf_work =
                stream_new(BGP_MAX_PACKET_SIZE + BGP_MAX_PACKET_SIZE_OVERFLOW);
@@@ -3143,6 -3145,9 +3143,9 @@@ int bgp_delete(struct bgp *bgp
                                   bgp->name);
        }
  
+       /* unmap from RT list */
+       bgp_evpn_vrf_delete(bgp);
        /* Stop timers. */
        if (bgp->t_rmap_def_originate_eval) {
                BGP_TIMER_OFF(bgp->t_rmap_def_originate_eval);
@@@ -7081,6 -7086,11 +7084,11 @@@ int bgp_config_write(struct vty *vty
  
        /* BGP configuration. */
        for (ALL_LIST_ELEMENTS(bm->bgp, mnode, mnnode, bgp)) {
+               /* skip all auto created vrf as they dont have user config */
+               if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_AUTO))
+                       continue;
                /* Router bgp ASN */
                vty_out(vty, "router bgp %u", bgp->as);
  
                if (bgp_option_check(BGP_OPT_CONFIG_CISCO))
                        vty_out(vty, " no auto-summary\n");
  
+               /* import route-target */
+               if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_IMPORT_RT_CFGD)) {
+                       char *ecom_str;
+                       struct listnode *node, *nnode;
+                       struct ecommunity *ecom;
+                       for (ALL_LIST_ELEMENTS(bgp->vrf_import_rtl, node, nnode,
+                                              ecom)) {
+                               ecom_str = ecommunity_ecom2str(
+                                       ecom, ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
+                               vty_out(vty, "   route-target import %s\n",
+                                       ecom_str);
+                               XFREE(MTYPE_ECOMMUNITY_STR, ecom_str);
+                       }
+               }
+               /* export route-target */
+               if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_EXPORT_RT_CFGD)) {
+                       char *ecom_str;
+                       struct listnode *node, *nnode;
+                       struct ecommunity *ecom;
+                       for (ALL_LIST_ELEMENTS(bgp->vrf_export_rtl, node, nnode,
+                                              ecom)) {
+                               ecom_str = ecommunity_ecom2str(
+                                       ecom, ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
+                               vty_out(vty, "   route-target export %s\n",
+                                       ecom_str);
+                               XFREE(MTYPE_ECOMMUNITY_STR, ecom_str);
+                       }
+               }
                /* IPv4 unicast configuration.  */
                bgp_config_write_family(vty, bgp, AFI_IP, SAFI_UNICAST);
  
@@@ -7365,6 -7407,13 +7405,13 @@@ void bgp_master_init(struct thread_mast
  
        bgp_process_queue_init();
  
+       /* init the rd id space.
+          assign 0th index in the bitfield,
+          so that we start with id 1
+        */
+       bf_init(bm->rd_idspace, UINT16_MAX);
+       bf_assign_zero_index(bm->rd_idspace);
        /* Enable multiple instances by default. */
        bgp_option_set(BGP_OPT_MULTIPLE_INSTANCE);
  
@@@ -7529,6 -7578,7 +7576,7 @@@ void bgp_terminate(void
         */
        /* reverse bgp_master_init */
        bgp_close();
        if (bm->listen_sockets)
                list_delete_and_null(&bm->listen_sockets);