golang/go

x/net/ipv4: wrong endianness in IP header on darwin-amd64

Open

#32,118 opened on May 17, 2019

View on GitHub
 (6 comments) (0 reactions) (0 assignees)Go (19,008 forks)batch import
NeedsInvestigationOS-Darwinhelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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)?

What 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.

Contributor guide