Skip to content

Commit 724624a

Browse files
authored
Merge pull request #17451 from opensourcerouting/fix/bgp_optimizations
bgpd: Optimize the outbound path if RFC8212 is applied
2 parents 564a8bc + 2dc7db9 commit 724624a

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

bgpd/bgp_route.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2326,6 +2326,27 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi,
23262326
}
23272327
}
23282328

2329+
/* RFC 8212 to prevent route leaks.
2330+
* This specification intends to improve this situation by requiring the
2331+
* explicit configuration of both BGP Import and Export Policies for any
2332+
* External BGP (EBGP) session such as customers, peers, or
2333+
* confederation boundaries for all enabled address families. Through
2334+
* codification of the aforementioned requirement, operators will
2335+
* benefit from consistent behavior across different BGP
2336+
* implementations.
2337+
*/
2338+
if (CHECK_FLAG(bgp->flags, BGP_FLAG_EBGP_REQUIRES_POLICY))
2339+
if (!bgp_outbound_policy_exists(peer, filter)) {
2340+
if (monotime_since(&bgp->ebgprequirespolicywarning, NULL) >
2341+
FIFTEENMINUTE2USEC ||
2342+
bgp->ebgprequirespolicywarning.tv_sec == 0) {
2343+
zlog_warn("%pBP [Update:SEND] %pFX EBGP outbound policy not properly setup, please configure in order for your peering to work correctly",
2344+
peer, p);
2345+
monotime(&bgp->ebgprequirespolicywarning);
2346+
}
2347+
return false;
2348+
}
2349+
23292350
/* Output filter check. */
23302351
if (bgp_output_filter(peer, p, piattr, afi, safi) == FILTER_DENY) {
23312352
if (bgp_debug_update(NULL, p, subgrp->update_group, 0))
@@ -2580,27 +2601,6 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi,
25802601
bgp_peer_remove_private_as(bgp, afi, safi, peer, attr);
25812602
bgp_peer_as_override(bgp, afi, safi, peer, attr);
25822603

2583-
/* RFC 8212 to prevent route leaks.
2584-
* This specification intends to improve this situation by requiring the
2585-
* explicit configuration of both BGP Import and Export Policies for any
2586-
* External BGP (EBGP) session such as customers, peers, or
2587-
* confederation boundaries for all enabled address families. Through
2588-
* codification of the aforementioned requirement, operators will
2589-
* benefit from consistent behavior across different BGP
2590-
* implementations.
2591-
*/
2592-
if (CHECK_FLAG(bgp->flags, BGP_FLAG_EBGP_REQUIRES_POLICY))
2593-
if (!bgp_outbound_policy_exists(peer, filter)) {
2594-
if (monotime_since(&bgp->ebgprequirespolicywarning,
2595-
NULL) > FIFTEENMINUTE2USEC ||
2596-
bgp->ebgprequirespolicywarning.tv_sec == 0) {
2597-
zlog_warn("%pBP [Update:SEND] %pFX EBGP outbound policy not properly setup, please configure in order for your peering to work correctly",
2598-
peer, p);
2599-
monotime(&bgp->ebgprequirespolicywarning);
2600-
}
2601-
return false;
2602-
}
2603-
26042604
/* draft-ietf-idr-deprecate-as-set-confed-set
26052605
* Filter routes having AS_SET or AS_CONFED_SET in the path.
26062606
* Eventually, This document (if approved) updates RFC 4271

0 commit comments

Comments
 (0)