-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
x/net/ipv4: wrong endianness in IP header on darwin-amd64 #32118
Comments
/cc @mikioh |
Can you show us a self-contained program we can use to recreate the problem? |
@ianlancetaylor this is the program to recreate the issue. https://github.com/hrqiang/iphdr/blob/master/iphdr.go |
@gopherbot add "help wanted" cc @odeke-em |
You can see this answer: https://stackoverflow.com/a/15881825/13019406 |
I understand the expected behavior, but this function is designed to receive a packet directly from the host's network layer and is not useful for parsing a header coming from another source. Imagine it coming from a tunnel or a VPN. The IP header is encapsulated in UDP, for example, and this function becomes unusable because it is only useful for messages that come exclusively from the native stack. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
marshall IPv4 IP header with x/net/ipv4/header, but I got little-endian instead of big-endian.
What did you expect to see?
Got big-endian IP header len.
What did you see instead?
little-endian
Looking at By looking at the code https://github.com/golang/net/blob/master/ipv4/header.go#L71., for darwin, 32bit/64bit os should have a different conversion.
Darwin amd64 is little-endian, it should convert.
The text was updated successfully, but these errors were encountered: