Skip to main content

Module orf

Module orf 

Source
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§

AddressPrefixOrf
A single Address-Prefix ORF entry (RFC 5291 §5.1.1 header + RFC 5292 §4).
OrfCapEntry
One per-(AFI,SAFI) block of the ORF capability value (RFC 5291 §4).
OrfCapType
One (ORF-Type, Send/Receive) pair inside a capability block.
OrfEntryGroup
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).
OrfSendReceive
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.
WhenToRefresh
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 None on a structural error or an unrecognized AFI/SAFI, so the caller can preserve the capability as Capability::Unknown for 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. family is 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.