pub struct LabeledNlriConfig {
pub add_path: bool,
pub mode: LabeledNlriMode,
pub max_labels: u8,
pub peer_max_labels: Option<u8>,
}Expand description
Configuration for parsing labeled NLRI
Fields§
§add_path: boolADD-PATH enabled (RFC 7911). When true, parse 4-byte path_id before each NLRI.
CRITICAL: ADD-PATH cannot be autodetected from NLRI bytes alone. If ADD-PATH is present on wire but this is false, the path_id bytes will be misinterpreted as NLRI length, causing complete stream desynchronization. The caller MUST configure this correctly based on session state.
mode: LabeledNlriModeRFC 8277 parsing mode (§2.2 SingleLabel vs §2.3 MultiLabel)
max_labels: u8Maximum label stack depth for DoS protection. RFC 8277 allows up to 254 (255 means unlimited). Range: 1..=254
peer_max_labels: Option<u8>Peer-negotiated maximum labels from Multiple Labels Capability.
If set and mode is MultiLabel, enforce this limit per RFC 8277 §2.1.
Receiving more labels than advertised produces a treat-as-withdraw error.
None means no peer limit (use local max_labels only).
Implementations§
Source§impl LabeledNlriConfig
impl LabeledNlriConfig
Sourcepub fn try_new(
add_path: bool,
mode: LabeledNlriMode,
max_labels: u8,
peer_max_labels: Option<u8>,
) -> Result<Self, LabeledNlriConfigError>
pub fn try_new( add_path: bool, mode: LabeledNlriMode, max_labels: u8, peer_max_labels: Option<u8>, ) -> Result<Self, LabeledNlriConfigError>
Create a new config with validation. Returns Err if max_labels is 0 or >254, or if peer_max_labels is Some(0). Note: per RFC 8277 §2.1, peer_max_labels of 1 is accepted (only 0 is forbidden).
Trait Implementations§
Source§impl Clone for LabeledNlriConfig
impl Clone for LabeledNlriConfig
Source§fn clone(&self) -> LabeledNlriConfig
fn clone(&self) -> LabeledNlriConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LabeledNlriConfig
impl Debug for LabeledNlriConfig
Source§impl Default for LabeledNlriConfig
impl Default for LabeledNlriConfig
Source§impl PartialEq for LabeledNlriConfig
impl PartialEq for LabeledNlriConfig
Source§fn eq(&self, other: &LabeledNlriConfig) -> bool
fn eq(&self, other: &LabeledNlriConfig) -> bool
self and other values to be equal, and is used by ==.impl Eq for LabeledNlriConfig
impl StructuralPartialEq for LabeledNlriConfig
Auto Trait Implementations§
impl Freeze for LabeledNlriConfig
impl RefUnwindSafe for LabeledNlriConfig
impl Send for LabeledNlriConfig
impl Sync for LabeledNlriConfig
impl Unpin for LabeledNlriConfig
impl UnsafeUnpin for LabeledNlriConfig
impl UnwindSafe for LabeledNlriConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more