Skip to content
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

net: Interface.MTU is an int, but on 32-bit windows the MTU size can be >2 GiB #48762

Open
YouROK opened this issue Oct 4, 2021 · 3 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Milestone

Comments

@YouROK
Copy link

YouROK commented Oct 4, 2021

What version of Go are you using (go version)?

go version go1.17 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/yourok/.cache/go-build"
GOENV="/home/yourok/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/yourok/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/yourok/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3437785326=/tmp/go-build -gno-record-gcc-switches"

In net.Interface MTU int, but in windows 32 bit the mtu size is sometimes more than 2 gb on loopback and the MTU value is negative.

MTU int // maximum transmission unit

@mknyszek mknyszek changed the title MTU value is negative net: net.Interface MTU is an int, but on 32-bit windows the MTU size can be >2 GiB Oct 4, 2021
@mknyszek mknyszek changed the title net: net.Interface MTU is an int, but on 32-bit windows the MTU size can be >2 GiB net: Interface.MTU is an int, but on 32-bit windows the MTU size can be >2 GiB Oct 4, 2021
@mknyszek mknyszek added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows labels Oct 4, 2021
@mknyszek mknyszek added this to the Backlog milestone Oct 4, 2021
@mknyszek
Copy link
Contributor

mknyszek commented Oct 4, 2021

CC @neild

I suspect there isn't really much we can do about this. MTU probably shouldn't have been an int if this case is possible, but I don't think it's possible to change it now, to follow the Go 1 backwards compatibility guarantee.

@bcmills
Copy link
Contributor

bcmills commented Oct 4, 2021

Time to add an MTU64 field? 🤷‍♂️

@neild
Copy link
Contributor

neild commented Oct 5, 2021

If nothing else, we should saturate MTU to maxint rather than overflowing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Windows
Projects
None yet
Development

No branches or pull requests

4 participants