Closed daniel-noland closed 4 months ago
I'm moving this out of draft state now because I think it can now be meaningfully reviewed.
I will work on squashing the remaining tiny TODO involving documentation, making sure all the doc links work correctly, and the other notes I left for myself. I will be very surprised if addressing any of those significantly change the code.
As things stand I
tc-actions
functionality.tc-tunnel_key
in addition to what is described in the issue.
If you like I will break this into three commits to account for that (or even three PRs if you feel it is necessary). EDIT: I put the documentation for the existing functionality in a distinct commit from the rest of the PR in case the actions functionality needs to be reverted.
I also made a slight amendment to the testing pattern by
I am happy to adapt that back into the existing testing pattern with hard coded vec![...]
statements and or remove the "parse back" style tests if you don't think they belong here.
Thanks for your documentation. The unit tests is nice too.
Thank you for the review :smile:
I will write fixups based on your comments.
If you think that flavor of unit tests is helpful (as I do, see #121) then we may also consider something like proptest or bolero to really expand on that "parse-back" strategy. We could even use bolero+kani if we wanna get really hardcore, but things like that are best done one step at a time.
It may also be worth looking at the rather unfortunate state of the higher level API this PR results in (see rust-netlink/rtnetlink#64) before we agree to merge this. If changes to this PR are needed to smooth out the rtnetlink api then that is best done before anybody (including rtnetlink) starts depending on this change set. Especially if we are going to try to 1.0 this library this year :smile: (something I really look forward to)
This segment of test code is especially unfortunate
This segment of test code is almost as sad
I have thoughts about what can be done to fix this. I will write them up shortly.
Thanks again :tada:
If you find it hard to capture netlink package as Vec
If you find it hard to capture netlink package as Vec, please let me know, I am happy to amend(and also validate) your test codes.
I can capture as a Vec
if that is better. It does remove the dev-dependency on hex. Will change
Feedback responses posted.
Summary of changes:
adjust use of NLA_F_NESTED
flag in both tests and emitted messages
to reflect the kernel's stated usage
(i.e. that NLA_F_NESTED
be set for the tc-actions options).
This required adjusting the tests which seem to have captured iproute2's incorrectly formed messages (iproute2 does not always set the NLA_F_NESTED
flag)
Remove the use of hex as a dev dependency
and use a const slice of u8
instead as per @cathay4t request
remove links to iproute2's github as per @cathay4t request
trivial documentation cleanup
restore deleted test
Will mark as ready for next review. Thanks for review.
I left the review response fixups as the last commit in this series to make review easier. I'm happy to squash that commit into the prior one before merge if you wish to keep the commit history clean
Any update on this?
Support for tc-actions
Add the building blocks for tc-actions support.
This PR is in the same spirit as my (in progress) work on florianl/go-tc#145
I broke out this functionality from my other PR #111 based on conversation and feedback from @cathay4t.
Summary of feature
This is easiest to explain by way of iproute2.
tc
allows actions to be created independently of filters. Once created, these actions may thenFor example, consider the following :
At this point, we could
list the
mirred
actionslist the
gact
actionscreate any number of filters using either or both of these actions by index
display those filters as normal (with per-action statistics)
centrally update those actions (e.g., change
drop
topass
)attempts to delete those actions while in use will be rejected (albeit with a buggy error message from
iproute2
/tc
)Removing all filters that use an action will allow the action to be deleted