netlink_packet_route/rule/
error.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// SPDX-License-Identifier: MIT

use crate::route::RouteError;
use netlink_packet_utils::nla::NlaError;
use netlink_packet_utils::DecodeError;
use thiserror::Error;

#[derive(Debug, Error)]
pub enum RuleError {
    #[error("Invalid {kind}")]
    InvalidValue { kind: &'static str, error: DecodeError },

    #[error("Unknown NLA type: {kind}")]
    UnknownNLA { kind: u16, error: DecodeError },

    #[error(transparent)]
    ParseNla(#[from] NlaError),

    #[error(transparent)]
    ParseFraFlow(#[from] RouteError),

    #[error("Invalid rule uid range data, expecting {expected} u8 array, but got {got}")]
    ParseUidRange { expected: usize, got: usize },

    #[error("Invalid rule port range data, expecting {expected} u8 array, but got {got}")]
    ParsePortRange { expected: usize, got: usize },
}