]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: aggr summary-only suppressed export to evpn 14919/head
authorChirag Shah <chirag@nvidia.com>
Sat, 23 Sep 2023 00:19:09 +0000 (17:19 -0700)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Thu, 30 Nov 2023 09:41:09 +0000 (11:41 +0200)
When exporting bgp vrf instance unicast route into
EVPN as type-5, check for suppressed ones and do not
export them.

Ticket:#3534718
Testing Done:

Config:

router bgp 660000 vrf vrf1
 bgp router-id 144.1.1.2
 no bgp network import-check
 neighbor 144.1.1.1 remote-as external
 !
 address-family ipv4 unicast
  aggregate-address 50.1.0.0/16 summary-only
  redistribute connected
 exit-address-family
 !
 address-family l2vpn evpn
  advertise ipv4 unicast
 exit-address-family
exit

v4 suppressed route: (5 suppressed routes not exported to evpn)

tor1# vtysh -c "show bgp vrf vrf1 ipv4 unicast" | grep "50.1"
*> 50.1.0.0/16      0.0.0.0(bordertor-11)
s> 50.1.1.212/32    6.0.0.30(leaf-11)<
s> 50.1.1.222/32    6.0.0.31(leaf-11)<
s> 50.1.110.0/24    0.0.0.0(bordertor-11)
s> 50.1.210.214/32  6.0.0.30(leaf-11)<
s> 50.1.220.224/32  6.0.0.31(leaf-11)<

tor1# vtysh -c "show bgp l2vpn evpn route" | grep -A3 "*> \[5\].*\[50.1"
*> [5]:[0]:[16]:[50.1.0.0] RD 144.1.1.2:7
                    6.0.0.1 (bordertor-11)
                                             0         32768 ?
                    ET:8 RT:4640:104001 Rmac:00:02:00:00:00:04

Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_evpn.c
bgpd/bgp_evpn.h
bgpd/bgp_route.c
bgpd/bgp_route.h

index cbd474cdcbfcdc285fbd092c00f76bd9a53334e3..64b1fb18da5b374884bf0a0a26353634f3f25f9e 100644 (file)
@@ -309,6 +309,39 @@ static int is_vni_present_in_irt_vnis(struct list *vnis, struct bgpevpn *vpn)
        return 0;
 }
 
+/* Flag if the route is injectable into EVPN.
+ * This would be following category:
+ * Non-imported route,
+ * Non-EVPN imported route,
+ * Non Aggregate suppressed route.
+ */
+bool is_route_injectable_into_evpn(struct bgp_path_info *pi)
+{
+       struct bgp_path_info *parent_pi;
+       struct bgp_table *table;
+       struct bgp_dest *dest;
+
+       /* do not import aggr suppressed routes */
+       if (bgp_path_suppressed(pi))
+               return false;
+
+       if (pi->sub_type != BGP_ROUTE_IMPORTED || !pi->extra ||
+           !pi->extra || !pi->extra->parent)
+               return true;
+
+        parent_pi = (struct bgp_path_info *)pi->extra->parent;
+        dest = parent_pi->net;
+        if (!dest)
+               return true;
+        table = bgp_dest_table(dest);
+        if (table &&
+            table->afi == AFI_L2VPN &&
+            table->safi == SAFI_EVPN)
+                return false;
+
+        return true;
+}
+
 /*
  * Compare Route Targets.
  */
index a034bfbd7ec8006001ab638e6ed2afe1035fc1fe..a1be06a4e406d82a1ea44cb8d70c4bede786ff46 100644 (file)
@@ -94,32 +94,6 @@ static inline bool is_pi_family_evpn(struct bgp_path_info *pi)
        return is_pi_family_matching(pi, AFI_L2VPN, SAFI_EVPN);
 }
 
-/* Flag if the route is injectable into EVPN. This would be either a
- * non-imported route or a non-EVPN imported route.
- */
-static inline bool is_route_injectable_into_evpn(struct bgp_path_info *pi)
-{
-       struct bgp_path_info *parent_pi;
-       struct bgp_table *table;
-       struct bgp_dest *dest;
-
-       if (pi->sub_type != BGP_ROUTE_IMPORTED ||
-           !pi->extra ||
-           !pi->extra->parent)
-               return true;
-
-       parent_pi = (struct bgp_path_info *)pi->extra->parent;
-       dest = parent_pi->net;
-       if (!dest)
-               return true;
-       table = bgp_dest_table(dest);
-       if (table &&
-           table->afi == AFI_L2VPN &&
-           table->safi == SAFI_EVPN)
-               return false;
-       return true;
-}
-
 static inline bool evpn_resolve_overlay_index(void)
 {
        struct bgp *bgp = NULL;
@@ -198,5 +172,6 @@ extern mpls_label_t *bgp_evpn_path_info_labels_get_l3vni(mpls_label_t *labels,
 extern vni_t bgp_evpn_path_info_get_l3vni(const struct bgp_path_info *pi);
 extern bool bgp_evpn_mpath_has_dvni(const struct bgp *bgp_vrf,
                                    struct bgp_path_info *mpinfo);
+extern bool is_route_injectable_into_evpn(struct bgp_path_info *pi);
 
 #endif /* _QUAGGA_BGP_EVPN_H */
index 0885c9f1a9d682efadee478f88bfb5f6c0134f6e..2cd61b94b0726d6497387aef0912af01da0b4504 100644 (file)
@@ -113,7 +113,7 @@ DEFINE_HOOK(bgp_process,
            (bgp, afi, safi, bn, peer, withdraw));
 
 /** Test if path is suppressed. */
-static bool bgp_path_suppressed(struct bgp_path_info *pi)
+bool bgp_path_suppressed(struct bgp_path_info *pi)
 {
        if (pi->extra == NULL || pi->extra->aggr_suppressors == NULL)
                return false;
index d5a00059ad2f652ec6172ab63575fcfcdc2b338d..b429578b0d8662056f0d682cdc507a4499dab5ee 100644 (file)
@@ -877,6 +877,7 @@ extern void bgp_aggregate_toggle_suppressed(struct bgp_aggregate *aggregate,
 extern void subgroup_announce_reset_nhop(uint8_t family, struct attr *attr);
 const char *
 bgp_path_selection_reason2str(enum bgp_path_selection_reason reason);
+extern bool bgp_path_suppressed(struct bgp_path_info *pi);
 extern bool bgp_addpath_encode_rx(struct peer *peer, afi_t afi, safi_t safi);
 extern const struct prefix_rd *bgp_rd_from_dest(const struct bgp_dest *dest,
                                                safi_t safi);