-
Couldn't load subscription status.
- Fork 105
debug: option to print using mnl format #219
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
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 your PR!
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.
This is awesome, I would be fine making this the default debugging format given that the existing one is probably not very useful for most circumstances.
I do think that the printer is complex enough to probably at least merit a unit test that dumps a fixed output and verifies that it does not drift.
@mdlayher added a commit to bump github actions and golang versions and defaulted the logger to |
1c052f9 to
813ac3b
Compare
nftables uses the libmnl library that has a particular debugging format. This format is also used for nftables --debug=all. google/nftables golang library to interact with nftables uses this library to interface with netlink directly. Since these libraries are not well documented, is common to have to dump the netlink bits to compare. This commit implements an option to choose the same format used in nftables by adding a new option to the NLDEBUG environmenta variable and using the format=mnl key value. For Linux systems mnl is the default format. Change-Id: I5f63753b3ada4d25565fe0bddac35e010510a34f
|
@mdlayher my apologies, somehow I didn't realize the PR was not updated until today, it should be ready for review now |
nftables uses the libmnl library that has a particular debugging format. This format is also used for nftables --debug=all. google/nftables golang library to interact with nftables uses this library to interface with netlink directly.
Since the netlink libraries and implementations are not well documented, is common to have to dump the netlink bits to compare.
This commit implements an option to choose the same format used in nftables by adding a new option to the NLDEBUG environmental variable and using the format=mnt key value.
Output of
nft --debug=allOutput of a
nftablesdump using google/nftables and setting the environment variablehttps://gist.github.com/aojea/8a811e11a060fa638aa2dd8165960d5a
NLDEBUG=format=mnl go run main.go cni-kindnet preroutingcc: @stapelberg