-
Notifications
You must be signed in to change notification settings - Fork 57
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 the matchall
filter in TrafficFilterNewRequest
#13
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.
- Do not use
assert
. - The commit message should be polished also.
- Add test case or example code for this new function.
9051d3d
to
f1b37db
Compare
Hi @cathay4t , I have cleaned up the commit message and added an example (this example depends on these 2 PRs: https://github.com/rust-netlink/netlink-packet-route/pull/20/files and rust-netlink/netlink-packet-route#22 ). Regarding the assert: I added the assert in to match the other code in the same struct. I agree that having the assert in library code should be avoided, however it seems odd to have one builder method return a result while the rest don't. This pattern is found also in the Alternately, I wonder if splitting the Let me know what you think about this! |
Hi @cathay4t - any thoughts on the above comment? |
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.
For assert, I have created #16 to track the effort of removing it.
I got compile failure when invoking cargo build --example subnet_nat
, please fix.
When I build this PR I see the errors:
Is this the errors you see? If so, it's because Cargo.toml still has this line:
But the matchall and tc nat patches aren't in version 0.15, they are on the main branch of the repo.
Fixes this on my computer (since all the rust-netlink repos are checked out into the same parent directory on my machine). I'm not sure of the proper way to handle this situation. If you are getting a different error, would you mind pasting it here, since it builds and runs for me? |
@sophacles Let me tag new release in |
@sophacles I have published |
Meanwhile, please remove |
Hi @cathay4t I have updated the PR by rebasing on main, updating the dependency, and fixing up the name changes. Note for the functions that have
If you would prefer a something else, please let me know and I'll update. |
f1b37db
to
4899829
Compare
@sophacles The patch looks good to me. I have already updated the dependencies. Please do the rebase again. Thank you! |
This adds a new method `matchall` to the TrafficFilterNewRequest struct, equivalent to commands like `tc filter ... matchall`. The matchall filter will match every packet and apply defined actions (etc) to it.
matchall
filter in TrafficFilterNewReq…matchall
filter in TrafficFilterNewRequest
Create a tc subnet nat on a specified interface using the CIDRs provided on the command line.
4899829
to
49646df
Compare
@cathay4t I've redone the rebase and pushed to my branch. Note: since the "remove asserts" pr was merged, the code has changed slightly in the |
@cathay4t do you need me to do anything else to this PR since my last update? |
Need to use latest API of netlink-packet-route
@sophacles Sorry for the wait. Please rebase to use latest netlink-packet-route API. |
@sophacles ping again. |
…uest