-
Notifications
You must be signed in to change notification settings - Fork 29
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
cgen: add an error counter #154
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 doing this!
Regarding nft
support for counters, it's a bit of a pain at the moment as it diverged a lot from what bfcli
can do. Also, if you send back the error counter, nftables
will have no idea what to do with it, as that doesn't exist in nft
world.
To check if your counter is updated, the easiest solution would be to use bpftool map dump id XXX
to dump the counters map (bf_cmap_xxx
).
bfcli
can't yet fetch the counters, but @ryantimwilson is working on it. In the meantime, I would suggest to go the bpftool
way, as neither iptables
nor nftables
has any concept of error counter.
c5ae505
to
6f10bb0
Compare
I've gone this route and dropped the NFT code (since I think it opens a can of worms there). Do you know of a good way to force failures on these paths and test? Everything seems to be the way I expect it, but I'd like to test with real faults on these paths. |
Unfortunately, no, as we would need to trigger an error on a You could change the conditional used to check for error, so the counters would be updated on success, that would be better than nothing. Furthermore, could you run |
9f609f8
to
46ecbdf
Compare
I've fixed the style as suggested. I ran some manual tests with the same counter in the valid path, and it seemed fine. I don't want to complicate this specific pull request, but thinking out loud: did adding a dynamic layer of functions for fault injection? (E.g. dynamically add a function indirection where the builtins are all bounced through a trampoline, which could probabalistically or deterministically inject various faults.) Is such a feature generally useful? Maybe alongside being able to control the fail open/closed behavior for each chain? (With the fault injection basically giving you the ability to test that.) |
That's a great idea, and it would definitely be useful for more than testing |
LGTM. The CI is mad because of
|
For kfunc call errors, add a dedicated counter that can be read by the daemon in the future. For now, this counter must be read via `bpftool` and is not available to other clients. This was tested manually with a separate path for the errors counters, as there is no suitable fault injection mechanism currently. Fixes facebook#105
Done! Thanks @amscanne for doing this! |
For kfunc call errors, add a dedicated counter that can be read by the daemon in the future. This counter is exposed implicitly as a named counter object ("errors") via
nft
.Fixes #105