-
Notifications
You must be signed in to change notification settings - Fork 259
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
Add support for iptables in nftables mode. #51
Conversation
@lucab would you mind taking a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of minor nits, otherwise LGTM.
test
Outdated
echo "Success" | ||
rm ${bin} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and above, please quote variables in ""
: "${bin}"
etc.
iptables/iptables.go
Outdated
if groups := counterRegex.FindStringSubmatch(rule); groups != nil { | ||
// drop the brackets | ||
rule = rule[len(groups[0]):] | ||
rule = fmt.Sprintf("%s -c %s %s", rule, groups[1], groups[2]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I'd personally prefer not shadowing input parameters and local variables, if possible.
Iptables also has the ability to work in nftables mode, where it is supposed to act like iptables but use the nftables subsystem. Unfortunately, it isn't exactly the same. The biggest difference is that counter output is iptables-save style, rather than with "-c N N". Also, improve some tests.
Updated, and added another fix for a failing testcase; PTAL |
Iptables also has the ability to work in nftables mode, where it is supposed to act like iptables but use the nftables subsystem. Unfortunately, it isn't exactly the same.
The biggest difference is that counter output is iptables-save style, rather than with "-c N N".
Also, improve some tests.
Fixes: #49