Commit Graph

53 Commits

Author SHA1 Message Date
Mikio Hara
803fdb99c0 ipv4, ipv6, icmp, internal/socket: fix build on netbsd/arm
Fixes golang/go#24346

Change-Id: I6b32d79135c0843d62425f4cc4c18f5a0eb9efd3
Reviewed-on: https://go-review.googlesource.com/100155
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-13 05:12:57 +00:00
Kevin Burke
0ed95abb35 all: use HTTPS for iana.org links
iana.org, www.iana.org and data.iana.org all present a valid TLS
certificate, so let's use it when fetching data to avoid errors in
transit.

Change-Id: I1f295442d24a221fe2b722c4782dceee38b960ec
Reviewed-on: https://go-review.googlesource.com/89415
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-24 06:09:56 +00:00
Mikio Hara
d866cfc389 internal/socket: fix typos
Change-Id: Ic4e0dc9ef27522606061e2ab212a9d6b2b40dd64
Reviewed-on: https://go-review.googlesource.com/83435
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-12-12 00:56:08 +00:00
Mikio Hara
dc871a5d77 Revert "internal/socket: enable {recv,send}mmsg on NetBSD"
This reverts commit 5c0ad186f0.

Change-Id: I1b6fac0f88816f4464e732d2f8a3d5510decb255
Reviewed-on: https://go-review.googlesource.com/82697
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2017-12-07 22:20:16 +00:00
Mikio Hara
5c0ad186f0 internal/socket: enable {recv,send}mmsg on NetBSD
Change-Id: Ide52e52d6859378bc12bb97081f63d657cb2a76f
Reviewed-on: https://go-review.googlesource.com/82455
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-12-07 21:46:16 +00:00
Mikio Hara
faacc1b5e3 internal/socket: add support for darwin/arm64
Fixes golang/go#22301.

Change-Id: I29f4f8806e10aad59cf7f984fd346acc216b0fd0
Reviewed-on: https://go-review.googlesource.com/79855
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-12-07 15:37:38 +00:00
Brad Fitzpatrick
a8b9294777 internal/nettest: skip unixpacket tests on netbsd/386
Updates golang/go#22927

Change-Id: I813b9ba92f9dd7e517385dc95df20691efee01a6
Reviewed-on: https://go-review.googlesource.com/80755
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-29 19:23:39 +00:00
Mikio Hara
a04bdaca5b internal/socket: make ipv4, ipv6 and icmp work again on android
On android, runtime.GOOS returns "android" instead of "linux".

Fixes golang/go#22115.

Change-Id: Idd24d5602f8fa9be1fca0b64bd8966849ea2b5e7
Reviewed-on: https://go-review.googlesource.com/67770
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-04 03:46:48 +00:00
Mikio Hara
4f8c76a975 internal/socket: don't crash with empty Message.Buffers
Fixes golang/go#22117.

Change-Id: I0d9c3e126aaf97cd297c84e064e9a521ddac626f
Reviewed-on: https://go-review.googlesource.com/67750
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-04 03:46:34 +00:00
Mikio Hara
dfe83d419c internal/socket: don't crash with corrupted control messages
Change-Id: I5c484662add4261f504607758521718f4c760375
Reviewed-on: https://go-review.googlesource.com/45294
TryBot-Result: Gobot Gobot <gobot@golang.org>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-06-13 07:54:37 +00:00
Mikio Hara
3da985ce59 internal/socket: fix 386 emulation on amd64 for FreeBSD
Unlike routing messages, there's no need to tweak the alignment for
socket control messages on freebsd/386 emulation.

Change-Id: Iab4a2b05080868721f7e42cebd661d445f8c1030
Reviewed-on: https://go-review.googlesource.com/44391
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-05-29 21:49:44 +00:00
Mikio Hara
b8b13433cc internal/socket: add message IO functionality
This change adds portable message IO methods of Conn, IO message and
control message types, and parse methods for the types to provide
those functionality to the ipv4 and ipv6 packages.

With this change, the ipv4 and ipv6 packages can provide low-level
(but less heap allocation and the cost of invoking system calls) API
such as read and write operations for a batch of IO messages.

On vanilla linux/amd64 virtual machine:
BenchmarkUDP/Iter-1-2            1000000              8068 ns/op             408 B/op         14 allocs/op
BenchmarkUDP/Batch-1-2           1000000              8610 ns/op             440 B/op         14 allocs/op
BenchmarkUDP/Iter-2-2             500000             15390 ns/op             816 B/op         28 allocs/op
BenchmarkUDP/Batch-2-2            500000             12715 ns/op             696 B/op         20 allocs/op
BenchmarkUDP/Iter-4-2             200000             30763 ns/op            1632 B/op         56 allocs/op
BenchmarkUDP/Batch-4-2            300000             21853 ns/op            1216 B/op         32 allocs/op
BenchmarkUDP/Iter-8-2             100000             61460 ns/op            3264 B/op        112 allocs/op
BenchmarkUDP/Batch-8-2            200000             39048 ns/op            2256 B/op         56 allocs/op
BenchmarkUDP/Iter-16-2             50000            122408 ns/op            6528 B/op        224 allocs/op
BenchmarkUDP/Batch-16-2           100000             72728 ns/op            4336 B/op        104 allocs/op
BenchmarkUDP/Iter-32-2             30000            243137 ns/op           13056 B/op        448 allocs/op
BenchmarkUDP/Batch-32-2            50000            141332 ns/op            8496 B/op        200 allocs/op
BenchmarkUDP/Iter-64-2             20000            488125 ns/op           26112 B/op        896 allocs/op
BenchmarkUDP/Batch-64-2            30000            282078 ns/op           16816 B/op        392 allocs/op
BenchmarkUDP/Iter-128-2            10000            973752 ns/op           52224 B/op       1792 allocs/op
BenchmarkUDP/Batch-128-2           10000            551021 ns/op           33456 B/op        776 allocs/op
BenchmarkUDP/Iter-256-2             3000           1977852 ns/op          104448 B/op       3584 allocs/op
BenchmarkUDP/Batch-256-2           10000           1252596 ns/op           66736 B/op       1544 allocs/op
BenchmarkUDP/Iter-512-2             2000           4147495 ns/op          208896 B/op       7168 allocs/op
BenchmarkUDP/Batch-512-2            3000           2175774 ns/op          121128 B/op       2612 allocs/op

Change-Id: I3e08b28917b62dbea7936a86acb24e25ccaf5365
Reviewed-on: https://go-review.googlesource.com/38212
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-05-26 03:27:46 +00:00
Mikio Hara
f61a77393d internal/socket: add platform-dependent boilerplate files
Change-Id: I951a1abc36083401d183d61c58a8186b5ce41c6c
Reviewed-on: https://go-review.googlesource.com/38211
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-05-26 03:23:34 +00:00
Mikio Hara
445979b94b internal/iana: update DSCP names
As per RFC 3246, the registry renames the name for DSCP 101110
(binary) from EF PHB to EF to clarify that a particular per-hop
behavior (PHB) is called expedited forwarding (EF).

Change-Id: I022c2fcd4bb42a210ae5c6ec62200b7c5a638250
Reviewed-on: https://go-review.googlesource.com/43695
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-05-24 08:43:57 +00:00
Mikio Hara
aa0b216c89 Revert "ipv4, ipv6, internal/netreflect, bpf: fix the x/net build"
This reverts https://go-review.googlesource.com/c/37401

Updates golang/go#19051.

Change-Id: Ia3cbc42213e3c519f91650e6308a7ca1f56b6189
Reviewed-on: https://go-review.googlesource.com/37417
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-05-24 08:43:35 +00:00
Mikio Hara
e1564c30db internal/socket: merge internal/netreflect into internal/socket package
Updates golang/go#19051.

Change-Id: I4d86de8ea3fb03e40dd50bc0351562fbfa2c46a7
Reviewed-on: https://go-review.googlesource.com/38277
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-05-24 08:43:03 +00:00
Mikio Hara
50e760fb1d internal/socket: new package
This is a counterpart of https://go-review.googlesource.com/37039.

This change introduces a package that provides a portable interface
for the manipulation of sockets using either syscall.Conn and
syscall.RawConn interfaces or the internal/netreflect package
appropriately.

The package ensures that a package using this works with all supported
versions of the Go standard library.

Updates golang/go#19051.

Change-Id: Ib72ea369e6839e77fed6e35b9aedc364e73c51cb
Reviewed-on: https://go-review.googlesource.com/37035
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-05-24 08:41:53 +00:00
Brad Fitzpatrick
b64f02211f ipv4, ipv6, internal/netreflect, bpf: fix the x/net build
The x/net package is currently broken for Go 1.9 (#19051) so
I am unable to use trybots for x/net/http2.

This disables the tests for the broken stuff and makes things compile
at least, so x/net trybots aren't broken for others.

Updates golang/go#19051

Change-Id: I67401d7ad32d855e99a417545328eb4e803287cc
Reviewed-on: https://go-review.googlesource.com/37401
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
2017-02-23 22:48:12 +00:00
Mikio Hara
b4690f45fa internal/netreflect: don't build on go1.9 or above
This package doesn't work with Go 1.9 or above.
The bypass surgery for grafting the net and internal/poll packages of
Go 1.9 starts with disabling this packge.

Updates golang/go#19051.

Change-Id: I82d742d267f155cf440884e845b24402a5a5bfdf
Reviewed-on: https://go-review.googlesource.com/37034
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-02-15 21:59:08 +00:00
Mikio Hara
236b8f043b internal/netreflect: fix test on NaCl and Plan 9
Change-Id: Ia8bc87d0398951d7be74779279dca177f499d293
Reviewed-on: https://go-review.googlesource.com/36377
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-02-06 04:49:50 +00:00
Dmitri Shuralyov
357296a763 all: single space after period
The tree's pretty inconsistent about single space vs double space
after a period in documentation. Make it consistently a single space,
per earlier decisions, and changes in go repository. This means
contributors won't be confused by misleading precedence.

This CL was generated with:

	perl -i -npe 's,^(\s*// .+[a-z]\.)  +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.)  +([A-Z])')

on top of copyright headers change in https://golang.org/cl/32878.

Follows https://golang.org/cl/20022.

Change-Id: I821e4a300122b4668aa31e12eaa914db615e5369
Reviewed-on: https://go-review.googlesource.com/32879
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-01 21:02:21 +00:00
Mikio Hara
60c41d1de8 internal/netreflect: more use of internal/nettest package
Change-Id: I4473e69bbb445ab27554f2dc625d0cbd79d7cfe5
Reviewed-on: https://go-review.googlesource.com/35072
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2017-01-10 03:49:38 +00:00
Mikio Hara
db8e241947 internal/nettest: add missing support for "unixgram" to TestableNetwork
Also updates the package description.

Change-Id: I782a9d34d5a35aff92873efc6d511f95686cd5d6
Reviewed-on: https://go-review.googlesource.com/35071
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2017-01-10 03:47:03 +00:00
Mikio Hara
b03f0d9a16 internal/nettest: add TestableNetwork, NewLocalListener and NewLocalPacketListener
Change-Id: I61475922625ce8dbeee4180807c3f021a502edf7
Reviewed-on: https://go-review.googlesource.com/34731
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-09 18:57:18 +00:00
Mikio Hara
9e26e06f4a internal/netreflect: use of internal/nettest package
Change-Id: Ia77cabda5ae189dd91c3e528b9769ba93581f00d
Reviewed-on: https://go-review.googlesource.com/34732
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-09 16:40:57 +00:00
Mikio Hara
6683f96f09 internal/nettest: make SupportsIPv6 return false on Darwin kernel version 12 or below
The kernel is used in OS X Mountain Lion or below, or iOS version 8 or
below.

Updates golang/go#17015.

Change-Id: I8a849dc2ab4e04535f893b776bf704079cc91977
Reviewed-on: https://go-review.googlesource.com/33250
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-16 07:48:41 +00:00
Dmitri Shuralyov
5d997795f7 all: make copyright headers consistent with one space after period
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>
2016-11-07 23:52:11 +00:00
Mikio Hara
26b81fba4e internel/nettest: add SupportsIPv6MulticastDeliveryOnLoopback
Also consolidate platform-dependent helper files.

Updates golang/go#17015.

Change-Id: Ibf09479762029ecc7229ab4bb233138e0d4e69d9
Reviewed-on: https://go-review.googlesource.com/28997
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-14 08:42:56 +00:00
Mikio Hara
9bc2a3340c internal/netreflect: fix test on nacl, plan9 and windows
Change-Id: Ia274e47affd5fc2b9bdea077fa8043887044d0ec
Reviewed-on: https://go-review.googlesource.com/28110
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-08-31 03:06:24 +00:00
Mikio Hara
6c89f96179 internal/netreflect: new package
This change introduces an internal package that provides the
manipulation of net package facilities by using runtime reflection.
The package is supposed to be used by ipv4 and ipv6 packages.

Change-Id: I73ec3b7d3762e675ca03ad9ee5e8a68e75ceb997
Reviewed-on: https://go-review.googlesource.com/27732
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-08-26 03:27:45 +00:00
Mikio Hara
0899459b4d internal/iana: update protocol numbers
Change-Id: I88b1fac3419f3e655a11cb22050fcd9a9a6c6616
Reviewed-on: https://go-review.googlesource.com/19786
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-02-23 00:41:38 +00:00
Mikio Hara
d9eac8b368 internal/iana: update protocol numbers
Change-Id: I643468dde9f2b3c8719795e92df821f821070ab4
Reviewed-on: https://go-review.googlesource.com/12628
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-24 21:59:50 +00:00
Mikio Hara
d9558e5c97 internal/nettest: fix build on nacl
Change-Id: Ib3cd96ec4156737d80feda0504c349da5d41dc75
Reviewed-on: https://go-review.googlesource.com/11603
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-29 08:41:31 +00:00
Mikio Hara
af03a19e5e netutil, internal/nettest: deflake TestLimitListener
Change-Id: Ic82974bcafa1723c96ece0b6b0b717b00b27774b
Reviewed-on: https://go-review.googlesource.com/11533
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-26 04:58:29 +00:00
David Symonds
a19b75acff internal/timeseries: New package.
This implements a time series data structure.
It is not a general purpose package, but will be used
by the upcoming trace package.

Change-Id: I3aa547b2f76582fea246b2b35b465b35499f3fda
Reviewed-on: https://go-review.googlesource.com/10720
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-05 00:09:03 +00:00
Mikio Hara
8bc62b7ce1 internal/nettest: add SupportsRawIPSocket that reports raw IP socket availability
This change copies a few code fragments from
https://golang.org/cl/13422044.

Change-Id: I7ceae3a59e15dc9f9ef4b2b64a41753aa9d6798b
Reviewed-on: https://go-review.googlesource.com/3400
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-29 10:45:53 +00:00
Mikio Hara
a1cbdfe7f2 internal/iana: update protocol numbers
Also fixes parseProtocolNumbers to make it possible to grab the recently
added keyword "deprecated" correctly.

Change-Id: I431da33a722eab9aa13ce1834acab4e9e6346bfd
Reviewed-on: https://go-review.googlesource.com/2852
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-16 01:10:03 +00:00
David Symonds
cbcac7bb84 internal/iana: fix a import comment in code generator.
Change-Id: I09adabf07366426451303f72b0f2e6a0869b7508
2014-12-10 15:17:44 +11:00
David Symonds
8aa6e209cb net: add import comments.
Change-Id: Ifab0fdaec1d810d268b7c19ad30f476802203b37
2014-12-09 14:17:11 +11:00
Mikio Hara
b745b482fe x/net/icmp: new package
This CL makes icmp an external package.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/182370043
2014-12-03 12:32:52 +09:00
Mikio Hara
fc168c3c5c x/net/internal/icmp: add support for non-privileged ICMP endpoint, known as ping socket
This CL adds PacketConn struct that implements net.PacketConn
interface.

Update golang/go#9166

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/182110043
2014-12-03 09:34:28 +09:00
Mikio Hara
2a8857c36e x/net/internal/icmp: add ParseIPv4Header
This CL adds ParseIPv4Header for parsing an IPv4 header in ICMP
error message. We cannot use ipv4.ParseHeader for it because they
are different things processed by either ip_input or icmp_input.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/184850043
2014-12-03 09:34:08 +09:00
Mikio Hara
a21e453f9c x/net/internal/icmp: add support for error message
This CL introduces few ICMP error message body types such as
DstUnreach, PacketTooBig, TimeExceeded or ParamProb.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/183850043
2014-12-03 09:33:49 +09:00
Mikio Hara
e93b1edd55 x/net/{internal/icmp,ipv4,ipv6}: better method for icmp.Type interface
LGTM=iant
R=iant, bradfitz
CC=golang-codereviews
https://golang.org/cl/173670044
2014-11-29 10:11:10 +09:00
Mikio Hara
89143d4521 x/net/internal/nettest: make routableIP not return the ipv6 loopback address
On some platform the IPv6 loopback address is not suitable to assign a name.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/165710043
2014-11-10 09:47:34 +09:00
Andrew Gerrand
fbe893ddcd go.net: use golang.org/x/... import paths
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/167030043
2014-11-10 09:04:43 +11:00
Mikio Hara
7db411a191 go.net/internal/nettest: add ProtocolNotSupported function
Moves from go.net/ipv4 pacakge to here, we use this function not only
for ipv4 testing but ipv6 testing.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/169150043
2014-11-09 20:13:42 +09:00
Mikio Hara
d8abf88473 go.net/internal/icmp: fix typo
LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/149680043
2014-10-10 06:55:56 +09:00
Mikio Hara
fb10a5fdb4 go.net/internal/nettest: new package
This CL factors out testing utilities used by both ipv4 and ipv6 packages.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/152070043
2014-10-07 06:58:24 +09:00
Mikio Hara
4dee47b476 go.net/internal/icmp: make sure IPv6PseudoHeader takes only IPv6 addresses
LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/142540044
2014-09-24 12:44:28 +09:00