-
Notifications
You must be signed in to change notification settings - Fork 26
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 Log Expression #56
base: main
Are you sure you want to change the base?
Conversation
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.
Thanks for wanting to contribute! I definitely see good usage for logging expressions!
Can you please also add this expression to the add-rules
example? It's nice to showcase as many expressions as possible. I'm thinking like:
allow_loopback_in_rule.add_expr(&nft_expr!(log));
unsafe { | ||
let expr = try_alloc!(sys::nftnl_expr_alloc(b"log\0" as *const _ as *const c_char)); | ||
if let Some(group) = self.group { | ||
sys::nftnl_expr_set_u16(expr, sys::NFTNL_EXPR_LOG_GROUP as u16, group as u16); |
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.
group as u16
<- group
is already a u16
, no need to cast.
} | ||
|
||
#[macro_export] | ||
macro_rules! nft_expr_log { |
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.
You also need to add this as a separate branch into nft_expr!
macro also. So it's possible to create all types of expression with just nft_expr!(...)
Please also squash some of your git history to tidy it up a bit 🙏 |
Builds on top of dead PR #46 to add log expressions to macros, and addresses PR comments
Fixes #45
This change is