debug: option to print using mnl format #219
Open
+600
−52
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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