-
Notifications
You must be signed in to change notification settings - Fork 99
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
debug: option to print using mnl format #219
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 |
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=mnt key value. Change-Id: Ifcddb31d1561074942ad8d6af74b134540eca5fe Signed-off-by: Antonio Ojea <aojea@google.com>
Change-Id: I0d067261c1c30c0dc25fbc92f162b0a3746158ef
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
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=all
Output of a
nftables
dump using google/nftables and setting the environment variablehttps://gist.github.com/aojea/8a811e11a060fa638aa2dd8165960d5a
NLDEBUG=format=mnl go run main.go cni-kindnet prerouting
cc: @stapelberg