bgpd: Recent bugs for 10.6#21256
Merged
donaldsharp merged 5 commits intoFRRouting:stable/10.6from Mar 19, 2026
Merged
Conversation
…p received There is no bounds check before the memcpy(). With Extended Message support enabled, incoming OPEN messages can be up to 65535 bytes, so the total size of unknown capability TLVs can far exceed 4096 bytes, overflowing the stack buffer. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
We shouldn't allow processing AFI/SAFI received in route-refresh message if we don't have this AFI/SAFI enabled for this peer. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
We didn't include confederation ASNs when counting hops, so let's count them in, and return as early as possible the as-path as it is. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
We do this already with NEXT_HOP attribute, so let's do the same with MP_REACH_NLRI attribute as well. Reported-by: Jiahao Lei Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Just to avoid memory leak. Noticed randomly. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Member
|
@greptile review |
Greptile SummaryThis PR backports several targeted bug fixes to
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Peer as BGP Peer
participant Open as bgp_open_option_parse
participant Cap as bgp_capability_parse(+error_end)
participant Hostname as bgp_capability_hostname
participant Attr as bgp_mp_reach_parse
participant AS4 as aspath_reconcile_as4
Peer->>Open: OPEN message
Open->>Cap: parse capabilities (error_data, error_end=error_data+MAX_PKT_SIZE)
Cap->>Hostname: CAPABILITY_CODE_FQDN
Note over Hostname: 1) check len byte readable<br/>2) reject empty (len==0)<br/>3) bounds-check hostname body<br/>4) XFREE old hostname/domainname<br/>5) XFREE hostname on domainname error
Hostname-->>Cap: 0 or -1
Note over Cap: bounds-guard before memcpy(*error)<br/>if (*error + cap_len+2 <= error_end)
Cap-->>Open: ret
Peer->>Attr: UPDATE w/ MP_REACH_NLRI (IPv4 NH)
Note over Attr: After reading NH bytes:<br/>ipv4_martian() && !allow_martian<br/>→ BGP_ATTR_PARSE_WITHDRAW
Peer->>AS4: AS_PATH + AS4_PATH
Note over AS4: hops = (AS_PATH hops+confeds)<br/> - (AS4_PATH hops+confeds)<br/>if hops < 0 → return dup(AS_PATH)<br/>(RFC 6793 §4.1.3)
AS4-->>Peer: reconciled path
Peer->>Attr: ROUTE-REFRESH (BoRR) for AFI/SAFI
Note over Attr: if !afc_nego[afi][safi] → NOOP<br/>else: SET ENHANCED_REFRESH<br/> bgp_set_stale_route() (no peer_active_nego guard)
Last reviewed commit: "bgpd: Free hostname ..." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.