diff options
author | Daniil Baturin <daniil@vyos.io> | 2023-05-12 13:38:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-12 13:38:38 +0100 |
commit | 9b60bf0a5f5bbedb2769472037050b058fe5fe72 (patch) | |
tree | 4096ddbf505672fc57379cf385eb5460dd76f84d | |
parent | 3ba073d0e1bed57a20fcd1ce7406c8ee2356d061 (diff) | |
parent | f0cf9ac8a97b2b389b2dbcec8cb17761c29efc78 (diff) | |
download | vyos-build-9b60bf0a5f5bbedb2769472037050b058fe5fe72.tar.gz vyos-build-9b60bf0a5f5bbedb2769472037050b058fe5fe72.zip |
Merge pull request #350 from zdc/T5221-equuleus
FRR: Fixed BGP as-override behavior
-rw-r--r-- | packages/frr/patches/0003-Fix-as-override-behavior.patch | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/packages/frr/patches/0003-Fix-as-override-behavior.patch b/packages/frr/patches/0003-Fix-as-override-behavior.patch new file mode 100644 index 00000000..e13ac3a7 --- /dev/null +++ b/packages/frr/patches/0003-Fix-as-override-behavior.patch @@ -0,0 +1,77 @@ +From 6320d4941777d317989209f26ca513379f729c30 Mon Sep 17 00:00:00 2001 +From: zsdc <taras@vyos.io> +Date: Fri, 12 May 2023 13:56:20 +0300 +Subject: [PATCH] Fix as-override behavior + +Backported 9bbdb4572d3bb255211fecf1c756452ab27e91c2 from FRR 8.5 +--- + bgpd/bgp_aspath.c | 22 ---------------------- + bgpd/bgp_aspath.h | 1 - + bgpd/bgp_route.c | 4 +--- + 3 files changed, 1 insertion(+), 26 deletions(-) + +diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c +index 5cf3c60fa..9595bae5f 100644 +--- a/bgpd/bgp_aspath.c ++++ b/bgpd/bgp_aspath.c +@@ -1215,28 +1215,6 @@ bool aspath_private_as_check(struct aspath *aspath) + return true; + } + +-/* Return True if the entire ASPATH consist of the specified ASN */ +-bool aspath_single_asn_check(struct aspath *aspath, as_t asn) +-{ +- struct assegment *seg; +- +- if (!(aspath && aspath->segments)) +- return false; +- +- seg = aspath->segments; +- +- while (seg) { +- int i; +- +- for (i = 0; i < seg->length; i++) { +- if (seg->as[i] != asn) +- return false; +- } +- seg = seg->next; +- } +- return true; +-} +- + /* Replace all instances of the target ASN with our own ASN */ + struct aspath *aspath_replace_specific_asn(struct aspath *aspath, + as_t target_asn, as_t our_asn) +diff --git a/bgpd/bgp_aspath.h b/bgpd/bgp_aspath.h +index 9df352fcd..9bab5bb7b 100644 +--- a/bgpd/bgp_aspath.h ++++ b/bgpd/bgp_aspath.h +@@ -108,7 +108,6 @@ extern unsigned int aspath_get_first_as(struct aspath *); + extern unsigned int aspath_get_last_as(struct aspath *); + extern int aspath_loop_check(struct aspath *, as_t); + extern bool aspath_private_as_check(struct aspath *); +-extern bool aspath_single_asn_check(struct aspath *, as_t asn); + extern struct aspath *aspath_replace_specific_asn(struct aspath *aspath, + as_t target_asn, + as_t our_asn); +diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c +index 48ccb669b..6de3e2a7f 100644 +--- a/bgpd/bgp_route.c ++++ b/bgpd/bgp_route.c +@@ -1571,11 +1571,9 @@ static void bgp_peer_as_override(struct bgp *bgp, afi_t afi, safi_t safi, + struct peer *peer, struct attr *attr) + { + if (peer->sort == BGP_PEER_EBGP +- && peer_af_flag_check(peer, afi, safi, PEER_FLAG_AS_OVERRIDE)) { +- if (aspath_single_asn_check(attr->aspath, peer->as)) ++ && peer_af_flag_check(peer, afi, safi, PEER_FLAG_AS_OVERRIDE)) + attr->aspath = aspath_replace_specific_asn( + attr->aspath, peer->as, bgp->as); +- } + } + + void bgp_attr_add_gshut_community(struct attr *attr) +-- +2.34.1 + |