Skip to main content

validate_update_attributes

Function validate_update_attributes 

Source
pub fn validate_update_attributes(
    attrs: &[PathAttribute],
    has_nlri: bool,
    has_body_nlri: bool,
    is_ebgp: bool,
) -> Result<(), UpdateError>
Expand description

Validate the semantic correctness of a set of path attributes.

This is separate from decode (which is structural — “can I read these bytes?”). Validation checks whether the attribute set is RFC-compliant for this UPDATE.

has_nlri — true if the UPDATE carries announced prefixes (body or MP). has_body_nlri — true if the UPDATE carries IPv4 NLRI in the body fields. is_ebgp — true if the session is external BGP.

§Errors

Returns an UpdateError with the appropriate subcode and data.