namib-project / nftables-rs

Safe abstraction for nftables JSON API (libnftables-json).
https://crates.io/crates/nftables
Apache License 2.0
23 stars 13 forks source link

Panic during deserialization in `get_current_ruleset` function #6

Closed selfuryon closed 11 months ago

selfuryon commented 1 year ago

Hello! I tried to use get_current_ruleset function, but it panicked:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("data did not match any variant of untagged enum NfObject", line: 1, column: 1814)', src/firewall.rs:31:64

I use NixOS and my current ruleset (nft -j list ruleset with replaced IP addresses) is here.

JKRhb commented 1 year ago

Hi @selfuryon, thank you for reporting this issue! Could you try again with the latest crate version? :) With the fix provided in #8, the function should not panic anymore.

jwhb commented 1 year ago

@selfuryon: Thanks for providing your ruleset. There were indeed a some unimplemented pieces around sets and the XT statement.

Your ruleset can be interpreted after the changes that I committed to this branch: https://github.com/namib-project/nftables-rs/tree/anonymous-sets

Could you please confirm that this works for you?

jwhb commented 1 year ago

The fixes will be available as #9.