8 Commits

Author SHA1 Message Date
Mikio Hara
b774fd8d5c ipv4: fix error values on header manipulation
This change makes header manipulation methods and functions return a nil
header error if the receiver or wire header is nil, a header too short
error if the header length field value of receiver or wire header is
short, and a extension header error if the wire extnsion header is
short.

Also replaces syscall.EWINDOWS or syscall.EPLAN9 with more descriptive,
platform independent error values.

Change-Id: I923fb60b1d68857cffc9df20f3f6cb2babbcdb1f
Reviewed-on: https://go-review.googlesource.com/c/net/+/129136
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2019-03-10 01:40:29 +00:00
Mikio Hara
b7a1f62a47 ipv4: add {Read,Write}Batch methods to {Packet,Raw}Conn
This change provides message IO functionality that may support the
construction of modern datagram transport protocols.

The modern datagram transport protocols on a multihomed node basically
need to control each packet path for traffic engineering by using
information belongs to network- or link-layer implementation. In
addtion, it's desirable to be able to do simultaneous transmission
across multiple network- or link-layer adjacencies wihtout any
additional cost.

The ReadBatch and WriteBatch methods of PacketConn and RawConn can be
used to read and write an IO message that contains the information of
network- or link-layer implementation, and read and write a batch of
IO messages on Linux. The Marshal and Parse methods of ControlMessage
and Header can help to marshal and parse information contained in IO
messages.

Updates golang/go#3661.

Change-Id: Ia84a9d3bc51641406eaaf4258f2a3066945cc323
Reviewed-on: https://go-review.googlesource.com/38275
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-27 06:01:44 +00:00
Mikio Hara
c4fa6e0d08 ipv4: plumb in the standard library of Go 1.9 by using internal/socket package
This change uses the internal/socket package to ensure that the ipv4
package works with all supported versions of the Go standard library.

Fixes golang/go#19051.

Change-Id: If0256007c749c319970533823a10afdc1ffbce31
Reviewed-on: https://go-review.googlesource.com/37036
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-05-24 08:42:31 +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
7625277703 ipv4: use of internal/netreflect package
Change-Id: Idffb7eace4d7913e7dfad2715d10dcd1762f83e4
Reviewed-on: https://go-review.googlesource.com/27733
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 23:50:02 +00:00
Mikio Hara
63ee83b038 go.net/ipv4: update TODOs
TODOs for stub files are unnecessary because they are stubs.
Also adds TODOs that need to be treated for spurious word
boundary access on some CPU architecture such as ARM, Power.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/171110043
2014-11-06 13:18:00 +09:00
Mikio Hara
ecb7ecda9c go.net/ipv4: simplify ancillary helpers
This CL reduces unnecessary allocations in ancillary helper
functions. Also clarifies documentation on ControlMessage,
ControlFlags.

benchmark                     old allocs   new allocs    delta
BenchmarkReadWriteNetUDP-2             6            6    0.00%
BenchmarkReadWriteIPv4UDP-2           17           15  -11.76%

R=dave
CC=golang-dev
https://golang.org/cl/9232050
2013-06-17 00:40:07 +09:00
Mikio Hara
d2e5a1215d go.net/ipv4: new package
Package ipv4 implements IP-level socket options for the Internet
Protocol version 4. It also provides raw IP socket access methods
including IPv4 header manipulation.

Fixes golang/go#3684.
Fixes golang/go#3820.

This CL requires CL 6426047;
net: add read, write message methods to IPConn, UDPConn

R=rsc, dave, alex.brainman
CC=gobot, golang-dev
https://golang.org/cl/6482044
2012-09-26 21:03:09 +09:00