This change adds simple validation for multipart messages to avoid
generating incorrect messages and introduces RawBody and RawExtension
to control message validation. RawBody and RawExtension are excluded
from normal message processing and can be used to construct crafted
messages for applications such as wire format testing.
Fixesgolang/go#28686.
Change-Id: I56f51d6566142f5e1dcc75cfce5250801e583d6d
Reviewed-on: https://go-review.googlesource.com/c/net/+/155859
Run-TryBot: Mikio Hara <mikioh.public.networking@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
RFC 7223, Section 3 defines 32 bits for if-index.
RFC 8335, Section 2.1 defines
"If the Interface Identification Object identifies the probed
interface by index, the length is equal to 8 and the payload contains
the if-index [RFC7223]."
The object should be comprised of a 4-byte object header and a 4-byte interface index.
Fixesgolang/go#28530
Change-Id: Ib3ac729b7ec738a90a8c76ef984da0d5b28fa9c9
GitHub-Last-Rev: eba6714ed4
GitHub-Pull-Request: golang/net#23
Reviewed-on: https://go-review.googlesource.com/c/146637
Run-TryBot: Mikio Hara <mikioh.public.networking@gmail.com>
Reviewed-by: Mikio Hara <mikioh.public.networking@gmail.com>
This reverts commit e11730110b.
Reason for revert: The reverted test case is one of typical wrong wire
format test cases. The exposed API intentionally doesn't provide any
extenion object validation because the API is also used to construct
wire format compliance test tools. The API is extesion object-agnostic
and should be able to transmit and receive payload containing extension
objects in wrong wire format. Please preserve such test cases for now.
If you want to drop such test case, please add 1) extension object
validation, 2) a control knob for skipping validation, then drop all of
them.
Change-Id: I5c488c95523488e511e7a91e29a2f24f08448415
Reviewed-on: https://go-review.googlesource.com/c/146877
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
On BSD variaints, for some historical reason, the data format used by raw
ICMP socket may differ from the IPv4 wire format and the format used by
raw IP socket. This change clarifies that input of ParseIPv4Header must
conform to the raw ICMP socket format.
Change-Id: I7288eccaaae0662d0437794098c8f7fc4a55d81e
Reviewed-on: https://go-review.googlesource.com/128216
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This change implements support for extended echo request and reply
messages, and interface identification object that can be used to test
the status of a probed interface via a proxy interface from a probing
interface as defined in RFC 8335.
It's package user's responsibility to make a complete RFC-compliant
PROBE initiator implementation using ipv4, ipv6 and icmp packages of
x/net repository.
Fixesgolang/go#24440.
Change-Id: I87ab8a7581c4d41a0c579805b0e3043e48ac85f0
Reviewed-on: https://go-review.googlesource.com/63999
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This change reorganizes the existing test cases for supporting new
messages and extension in upcoming CLs. It also renames ping_test.go
to diag_test.go for clarification.
Updates golang/go#24440.
Change-Id: I5753a2ddbe76423d996a37f583fcf32b65d380e9
Reviewed-on: https://go-review.googlesource.com/63995
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Go policy has been single space after periods in comments for some time.
The copyright header template at:
https://golang.org/doc/contribute.html#copyright
also uses a single space.
Make them all consistent.
This CL was generated with:
perl -i -npe 's,^(// Copyright [0-9]+ The Go Authors\.) (All rights reserved\.)$,$1 $2,' $(git grep -l -E '^// Copyright [0-9]+ The Go Authors\. All rights reserved\.$')
Follows https://golang.org/cl/20111.
Change-Id: I66671dddf821f5dc027bc254e0196b3e3a2bdf3b
Reviewed-on: https://go-review.googlesource.com/32878
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This change fixes lazy socket descriptor handling in ListenPacket to
avoid treading on someone's socket descriptors which are recycled by
descriptor duplication. The issue happens when calling ListenPacket for
non-privileged ICMP endpoint concurrently.
Fixesgolang/go#16969.
Change-Id: I4d7672535f5aeb2a0b71f8af2c7ba271a085f418
Reviewed-on: https://go-review.googlesource.com/28473
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Also fixes ping tests. Latest Linux kernels prohibit to access ICMPv6
properties with non-privileged sockets.
Fixesgolang/go#12163.
Change-Id: I439b41556e8d4c2f3a9f725131267469e08c9599
Reviewed-on: https://go-review.googlesource.com/13653
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This change splits the existing ping test into non-privileged and
privileged tests to cover IPConn full stack test on behalf of the
standard library.
Updates golang/go#10730.
Change-Id: I5d2e00c0b42b857045414eb8e0efca393967742e
Reviewed-on: https://go-review.googlesource.com/10090
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This change implements ICMP extensions for interface and next-hop
identification which are used for route trace applications as described
in RFC 5837.
Change-Id: I2435109b5e766e743b894b0280a537324975489d
Reviewed-on: https://go-review.googlesource.com/3112
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This change implements ICMP multi-part message marshaler, parser and
extensions for MPLS which are used for route trace applications as
described in RFC 4950.
API breaking changes:
type MessageBody interface, Len() int
type Extension interface, Len() int
type Extension interface, Marshal() ([]byte, error)
are replaced with
type MessageBody interface, Len(int) int
type Extension interface, Len(int) int
type Extension interface, Marshal(int) ([]byte, error)
Change-Id: Iee1f2e03916d49b8dfe3a89fe682c702d40ecc85
Reviewed-on: https://go-review.googlesource.com/2794
Reviewed-by: Ian Lance Taylor <iant@golang.org>
ICMP extension structures allow a few existing ICMP error messages to
convey extra information for troubleshooting; especially the root cause
of why the original datagram could not be delivered.
This CL adds generic support for ICMP extension stuructures to
DstUnreach, TimeExceeded and ParamProb structs. Specific extensions such
as MPLS label-stack, interface and next-hop identification will be
inplemneted in separate followup CLs.
Change-Id: I90798c135bdf76b806e2dde2bdd57c2c11d7e7e9