Expand description
Outbound Route Filtering (ORF) types and codec (RFC 5291 + RFC 5292). Outbound Route Filtering (ORF) types and codec — RFC 5291 + RFC 5292.
ORF is a negotiated capability (code 3) that lets a BGP speaker push a filter to its peer; the peer applies that filter to the routes it advertises back. rustbgpd implements the receive side of the Address-Prefix ORF-Type (RFC 5292): it advertises that it is willing to receive ORF entries and applies them to its Adj-RIB-Out for that peer.
This module is the pure wire codec. Semantic validation (is the ORF-Type
negotiated? is min_len <= max_len?) is the caller’s responsibility — see
the transport/RIB layers. Only genuine BGP-framing errors (truncation, or a
group length that overruns the message body) return a DecodeError; a
malformed Address-Prefix entry (undefined Action, or a prefix length
beyond the address family) decodes into OrfEntries::Malformed so the
caller can apply the RFC 5291 §5.2 reset instead of tearing the session down.
Structs§
- Address
Prefix Orf - A single Address-Prefix ORF entry (RFC 5291 §5.1.1 header + RFC 5292 §4).
- OrfCap
Entry - One per-(AFI,SAFI) block of the ORF capability value (RFC 5291 §4).
- OrfCap
Type - One (ORF-Type, Send/Receive) pair inside a capability block.
- OrfEntry
Group - One ORF-Type group within a ROUTE-REFRESH ORF payload (RFC 5291 §5.2).
- OrfPayload
- The ORF section carried in a ROUTE-REFRESH message (RFC 5291 §5.2), following the standard AFI/Reserved/SAFI header.
Enums§
- OrfAction
- Action field of a common ORF entry header (RFC 5291 §5.1.1).
- OrfEntries
- Decoded entries of one ORF-Type group inside a ROUTE-REFRESH.
- OrfMatch
- Match field of a common ORF entry header (RFC 5291 §5.1.1).
- OrfSend
Receive - Capability Send/Receive field (RFC 5291 §4). Unknown values are preserved.
- OrfType
- ORF-Type (RFC 5291 §5 / RFC 5292). Unknown types are preserved so the codec round-trips forward-defined types losslessly.
- When
ToRefresh - ROUTE-REFRESH When-to-refresh octet (RFC 5291 §5.2). Unknown values preserved.
Functions§
- capability_
value_ len - Encoded length of the ORF capability value (sum over blocks).
- decode_
capability_ value - Decode the ORF capability value. Returns
Noneon a structural error or an unrecognized AFI/SAFI, so the caller can preserve the capability asCapability::Unknownfor a lossless round-trip (mirroring Add-Path). - decode_
route_ refresh_ orf - Decode the ORF section of a ROUTE-REFRESH body, after the AFI/Reserved/SAFI
header.
familyis the resolved AFI/SAFI pair of the message. Address- Prefix entries are parsed only for IPv4/IPv6 unicast, where their prefix encoding is defined here; other families are kept as raw bytes. - encode_
capability_ value - Encode the ORF capability value (without the capability code/length header).
- encode_
route_ refresh_ orf - Encode an ORF payload after the AFI/Reserved/SAFI header (used for round-trip tests; rustbgpd is receive-side and does not emit ORF in production).
- route_
refresh_ orf_ len - Encoded length of an ORF payload: When-to-refresh(1) + per group
ORF-Type(1) + Length(2) + entry bytes.