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

Update queue flags to be optional #5

Closed noelatmerqury closed 1 year ago

noelatmerqury commented 1 year ago

Set the Queue flags to be optional because they may not always be provided. For example running the below commands would result in an output JSON that would cause the library to return an error when parsing.

sudo nft add table ip mytable
sudo nft add chain ip mytable out-chain "{ type filter hook output priority 0;}"
sudo nft add rule ip mytable out-chain udp dport 20000 queue num 0

This PR fixes this issue by setting the queue flags as optional. An associated unit test has been added to verify functionality.

noelatmerqury commented 1 year ago

Fixing an issue with serialisation to JSON. Will push a fix soon.

noelatmerqury commented 1 year ago

Fixing an issue with serialisation to JSON. Will push a fix soon.

@JKRhb This has now been fixed and tested.

jwhb commented 1 year ago

Nice contribution, thanks @noelatmerqury! LGTM.