use nftables::helper::get_current_ruleset;
fn main() {
let _set = get_current_ruleset(None, None).unwrap();
println!("Rules were parsed successfully");
}
Before the fix:
thread 'main' panicked at examples/pr.rs:4:48:
called `Result::unwrap()` on an `Err` value: NftInvalidJson(Error("data did not match any variant of untagged enum NfObject", line: 1, column: 1296))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
This brought a repeating issue with key names to my attention.
I created #13 as a follow-up issue to fix other related key name issues and create test cases.
According to https://manpages.debian.org/testing/libnftables1/libnftables-json.5.en.html the key should be
tcp option
, nottcpoption
. Tested with the following rule:nft 'add rule ip mangle FORWARD tcp flags syn / syn,rst counter tcp option maxseg size set rt mtu'
and the following example code:Before the fix:
After the fix: