Skip to content

Commit 71d08ec

Browse files
committed
bgpd: aggr summary-only suppressed export to evpn
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 <[email protected]>
1 parent 4aff978 commit 71d08ec

File tree

4 files changed

+36
-26
lines changed

4 files changed

+36
-26
lines changed

bgpd/bgp_evpn.c

+33
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,39 @@ static int is_vni_present_in_irt_vnis(struct list *vnis, struct bgpevpn *vpn)
311311
return 0;
312312
}
313313

314+
/* Flag if the route is injectable into EVPN.
315+
* This would be following category:
316+
* Non-imported route,
317+
* Non-EVPN imported route,
318+
* Non Aggregate suppressed route.
319+
*/
320+
bool is_route_injectable_into_evpn(struct bgp_path_info *pi)
321+
{
322+
struct bgp_path_info *parent_pi;
323+
struct bgp_table *table;
324+
struct bgp_dest *dest;
325+
326+
/* do not import aggr suppressed routes */
327+
if (bgp_path_suppressed(pi))
328+
return false;
329+
330+
if (pi->sub_type != BGP_ROUTE_IMPORTED || !pi->extra ||
331+
!pi->extra->vrfleak || !pi->extra->vrfleak->parent)
332+
return true;
333+
334+
parent_pi = (struct bgp_path_info *)pi->extra->vrfleak->parent;
335+
dest = parent_pi->net;
336+
if (!dest)
337+
return true;
338+
table = bgp_dest_table(dest);
339+
if (table &&
340+
table->afi == AFI_L2VPN &&
341+
table->safi == SAFI_EVPN)
342+
return false;
343+
344+
return true;
345+
}
346+
314347
/*
315348
* Compare Route Targets.
316349
*/

bgpd/bgp_evpn.h

+1-25
Original file line numberDiff line numberDiff line change
@@ -94,31 +94,6 @@ static inline bool is_pi_family_evpn(struct bgp_path_info *pi)
9494
return is_pi_family_matching(pi, AFI_L2VPN, SAFI_EVPN);
9595
}
9696

97-
/* Flag if the route is injectable into EVPN. This would be either a
98-
* non-imported route or a non-EVPN imported route.
99-
*/
100-
static inline bool is_route_injectable_into_evpn(struct bgp_path_info *pi)
101-
{
102-
struct bgp_path_info *parent_pi;
103-
struct bgp_table *table;
104-
struct bgp_dest *dest;
105-
106-
if (pi->sub_type != BGP_ROUTE_IMPORTED || !pi->extra ||
107-
!pi->extra->vrfleak || !pi->extra->vrfleak->parent)
108-
return true;
109-
110-
parent_pi = (struct bgp_path_info *)pi->extra->vrfleak->parent;
111-
dest = parent_pi->net;
112-
if (!dest)
113-
return true;
114-
table = bgp_dest_table(dest);
115-
if (table &&
116-
table->afi == AFI_L2VPN &&
117-
table->safi == SAFI_EVPN)
118-
return false;
119-
return true;
120-
}
121-
12297
static inline bool evpn_resolve_overlay_index(void)
12398
{
12499
struct bgp *bgp = NULL;
@@ -206,5 +181,6 @@ extern mpls_label_t *bgp_evpn_path_info_labels_get_l3vni(mpls_label_t *labels,
206181
extern vni_t bgp_evpn_path_info_get_l3vni(const struct bgp_path_info *pi);
207182
extern bool bgp_evpn_mpath_has_dvni(const struct bgp *bgp_vrf,
208183
struct bgp_path_info *mpinfo);
184+
extern bool is_route_injectable_into_evpn(struct bgp_path_info *pi);
209185

210186
#endif /* _QUAGGA_BGP_EVPN_H */

bgpd/bgp_route.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ DEFINE_HOOK(bgp_process,
120120
(bgp, afi, safi, bn, peer, withdraw));
121121

122122
/** Test if path is suppressed. */
123-
static bool bgp_path_suppressed(struct bgp_path_info *pi)
123+
bool bgp_path_suppressed(struct bgp_path_info *pi)
124124
{
125125
if (pi->extra == NULL || pi->extra->aggr_suppressors == NULL)
126126
return false;

bgpd/bgp_route.h

+1
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,7 @@ extern void bgp_aggregate_toggle_suppressed(struct bgp_aggregate *aggregate,
914914
extern void subgroup_announce_reset_nhop(uint8_t family, struct attr *attr);
915915
const char *
916916
bgp_path_selection_reason2str(enum bgp_path_selection_reason reason);
917+
extern bool bgp_path_suppressed(struct bgp_path_info *pi);
917918
extern bool bgp_addpath_encode_rx(struct peer *peer, afi_t afi, safi_t safi);
918919
extern const struct prefix_rd *bgp_rd_from_dest(const struct bgp_dest *dest,
919920
safi_t safi);

0 commit comments

Comments
 (0)