/// Make sure a Next Header is valid.
///
/// Check if the provided `next_header` is a valid Next Header value. Note,
/// we are intentionally not allowing HopByHopOptions after the first Next
/// Header as per section 4.1 of RFC 8200 which restricts the HopByHop extension
/// header to only appear as the very first extension header. `is_valid_next_header`.
/// If a caller specifies `for_fixed_header` as true, then it is assumed `next_header` is
/// the Next Header value in the fixed header, where a HopbyHopOptions extension
/// header number is allowed.
Make sure a Next Header is valid.
Check if the provided `next_header` is a valid Next Header value. Note,
we are intentionally not allowing HopByHopOptions after the first Next
Header as per section 4.1 of RFC 8200 which restricts the HopByHop extension
header to only appear as the very first extension header.
Make sure a Next Header is valid . Check if the provided ` next_header ` is a valid Next Header value . Note we are intentionally not allowing HopByHopOptions after the first Next Header as per section 4 . 1 of RFC 8200 which restricts the HopByHop extension header to only appear as the very first extension header .
pub(super) fn is_valid_next_header(next_header: u8, for_fixed_header: bool) -> bool {
        // Make sure the Next Header in the fixed header is a valid extension
        // header or a valid upper layer protocol.
        match Ipv6ExtHdrType::from(next_header) {
            // HopByHop Options Extension header as a next header value
            // is only valid if it is in the fixed header.
            Ipv6ExtHdrType::HopByHopOptions => for_fixed_header,
            // Not an IPv6 Extension header number, so make sure it is
            // a valid upper layer protocol.
            Ipv6ExtHdrType::Other(next_header) => is_valid_next_header_upper_layer(next_header),
            // All valid Extension Header numbers
            _ => true,
        }
    }
pub ( super ) fn is_valid_next_header ( next_header : u8 , for_fixed_header : bool ) -> bool { // Make sure the Next Header in the fixed header is a valid extension // header or a valid upper layer protocol. match Ipv6ExtHdrType :: from ( next_header ) { // HopByHop Options Extension header as a next header value // is only valid if it is in the fixed header. Ipv6ExtHdrType :: HopByHopOptions => for_fixed_header , // Not an IPv6 Extension header number, so make sure it is // a valid upper layer protocol. Ipv6ExtHdrType :: Other ( next_header ) => is_valid_next_header_upper_layer ( next_header ) , // All valid Extension Header numbers _ => true , } }
Make sure a Next Header is valid.
Make sure a Next Header is valid .
next_header
u8
for_fixed_header
bool