Skip to main content

asterust_junos/interfaces/unit/family/
rpf_check.rs

1//! `interfaces { <name> { unit <n> { family <name> { rpf-check { ... } } } } }`.
2
3use crate::{statement_words, value_after};
4use asterust::config::ConfigLine;
5
6/// The `rpf-check` unicast reverse-path-forwarding settings; both fields are `None` for a bare `rpf-check;`.
7#[derive(Clone, Debug, Default, PartialEq, Eq)]
8#[non_exhaustive]
9pub struct RpfCheck {
10    pub fail_filter: Option<String>,
11    /// `strict` or `loose`.
12    pub mode: Option<String>,
13}
14
15pub(super) fn parse_rpf_check(family: &ConfigLine) -> Option<RpfCheck> {
16    let words = statement_words(family, "rpf-check")?;
17    Some(RpfCheck {
18        fail_filter: value_after(&words, "fail-filter"),
19        mode: value_after(&words, "mode"),
20    })
21}