-
Notifications
You must be signed in to change notification settings - Fork 139
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
Userdata in sets always set key to big endian #123
Comments
cc @sbezverk |
@geNAZt Since I did not have and still do not have any little endian platform to play with, the key in userdata has not been tested with it. As far as I remember go does not offer great runtime detection of the |
Our |
Ok, my expectation would be that i can set UserData (like any other argument) since this is a very low level lib. I would not want to have the library "guess" the correct UserData, i would like to tell the lib which values to use in that case. |
Any idea how to overcome the display bug? |
There is static userdata inside the set marshal:
https://github.com/google/nftables/blob/master/set.go#L386
According to nftables code:
https://git.netfilter.org/nftables/tree/src/netlink.c#n715
When i look up the enum in the nft lib i found that keybyteorder and databyteorder are values 0 and 1:
https://git.netfilter.org/libnftnl/tree/include/libnftnl/udata.h#n40
I also found this byteoder enum: http://charette.no-ip.com:81/programming/doxygen/netfilter/datatype_8h.html#aec0612005abb2f2a88c2de638a442cf2
This would set the key data type to be big endian encoded. I can also observe that when i use this example code:
This generates a netlink message like this:
When i look into how the second key is defined we can see that its correctly little endian:
8 0 1 0 1 0 0 0
Here is the userdata from nftables when i create the same set with it:
I can observe that it sets key 0 (endianness for key) to 1 (LE) and for key 1 (data) to 2 (BE).
It would be awesome to control userdata in that case so that nft does show the correct output and not display LE uint32 as BE which confuses operations :D
Thanks
The text was updated successfully, but these errors were encountered: