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

x/net/icmp: checksums are not checked when parsing a message #70340

Open
qdm12 opened this issue Nov 14, 2024 · 0 comments
Open

x/net/icmp: checksums are not checked when parsing a message #70340

qdm12 opened this issue Nov 14, 2024 · 0 comments
Milestone

Comments

@qdm12
Copy link
Contributor

qdm12 commented Nov 14, 2024

Go version

go version go1.23.2 linux/amd64

Output of go env in your module/workspace:

GO111MODULE='on'
GOARCH='amd64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.2'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/root/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='0'
GOMOD='/workspaces/gluetun/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3015057780=/tmp/go-build -gno-record-gcc-switches'

What did you do?

I'm working with the icmp package, and I noticed the ParseMessage function only stores the checksum in the returned message. There is no check using that checksum, nor any function available to run this checksum check.

On the other hand, in the Marshal method, the checksum is calculated.

What did you see happen?

No checksum check done when decoding an icmp message.

What did you expect to see?

A checksum check done when decoding an icmp message.
Since this check is rather cheap to run on a tiny amount of data (the icmp header), I think we could just have it as a part of the parsing function, and NOT export the checksum function.

@gopherbot gopherbot added this to the Unreleased milestone Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants