diff --git a/src/expr.rs b/src/expr.rs index 5640e4d..206577c 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize}; use std::collections::HashSet; use crate::stmt::Statement; +use crate::stmt::Counter; #[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)] #[serde(untagged)] @@ -355,9 +356,10 @@ pub enum Verdict { /// Explicitly set element object. pub struct Elem { pub val: Box, - pub timeout: u32, - pub expires: u32, - pub comment: String, + pub timeout: Option, + pub expires: Option, + pub comment: Option, + pub counter: Option, } #[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)] diff --git a/src/schema.rs b/src/schema.rs index 0bfe949..88daed4 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -193,6 +193,8 @@ pub struct Set { pub gc_interval: Option, #[serde(skip_serializing_if = "Option::is_none")] pub size: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub comment: Option, } #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] @@ -232,6 +234,9 @@ pub enum SetType { #[serde(rename = "mark")] #[strum(serialize="mark")] Mark, + #[serde(rename = "ifname")] + #[strum(serialize="ifname")] + Ifname, } #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] @@ -249,6 +254,7 @@ pub enum SetFlag { Constant, Interval, Timeout, + Dynamic, } #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] diff --git a/tests/helper_tests.rs b/tests/helper_tests.rs index 2cb8af8..9576308 100644 --- a/tests/helper_tests.rs +++ b/tests/helper_tests.rs @@ -57,6 +57,7 @@ fn example_ruleset() -> schema::Nftables { timeout: None, gc_interval: None, size: None, + comment: None, })); // add element to set batch.add(schema::NfListObject::Element(schema::Element {