Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TCP option key name #10

Merged
merged 1 commit into from
Jan 19, 2024
Merged

Conversation

Disasm
Copy link
Contributor

@Disasm Disasm commented Jan 12, 2024

According to https://manpages.debian.org/testing/libnftables1/libnftables-json.5.en.html the key should be tcp option, not tcpoption.
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:

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

After the fix:

Rules were parsed successfully

@Disasm Disasm force-pushed the fix-tcp-option-parsing branch from b3aea00 to 78b001c Compare January 12, 2024 08:08
@JKRhb JKRhb requested a review from jwhb January 12, 2024 10:20
@jwhb jwhb mentioned this pull request Jan 19, 2024
@jwhb
Copy link
Member

jwhb commented Jan 19, 2024

@Disasm thank you for your contribution!

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.

@jwhb jwhb merged commit b798d96 into namib-project:main Jan 19, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants