Instead of relying on syscall.Syscall, always reach into the syscall
package to call the appropriate functions on Unix systems. We were
already doing this on Darwin. We also have to do this on
OpenBSD. Rather than sometimes reach into syscall and sometimes not,
just always reach in.
For golang/go#42064
Change-Id: Ie292a56766080d0c5ae6b6723d42b5475128290c
Reviewed-on: https://go-review.googlesource.com/c/net/+/366354
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Under some circumstances, DragonFly BSD appears to put more addresses
in route messages than are indicated in the message header. Remove
the recently-added check for unparsed bytes in a route message to
avoid errors.
Change-Id: Id567e4cd49470970f78dbd2decd682c4c00b27fa
Reviewed-on: https://go-review.googlesource.com/c/net/+/322429
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
CL 139566 changes the alignment of routing messages on FreeBSD 386
11.2-RELEASE and above kernels to 32-bit.
Empirically, freebsd-386 builders are observing 64-bit aligned routing
messages. Change the alignment back to 64-bit.
Adjust the parsing of routing messages on all platforms to return an
error if the total size of the message does not match expectations.
Fixesgolang/go#35513
Change-Id: I0809b8c899b5d84cab7bb4451e3074eee81e2904
Reviewed-on: https://go-review.googlesource.com/c/net/+/321869
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Go 1.12 and newer are using libSystem for syscalls on darwin.
Go 1.11 is the last release to use direct syscalls. It hasn't been
supported since the release of Go 1.13 in September 2019, so drop
support for direct syscalls on darwin from golang.org/x/net.
Change-Id: Ib53d64e8a6d12ad702951f8efc123ce92c01c4d9
Reviewed-on: https://go-review.googlesource.com/c/net/+/257057
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
- DragonFly BSD removed RTM_OLDADD and RTM_OLDDEL
constants on Aug 4th, 2017 and are now gone in both master
branch and RELEASE 5.6. It also removed IPV6_IPSEC_POLICY
constant since IPSEC was removed from base and kernel.
Change-Id: I99fbdfcb95fb276374f7b2dbd5fa30fe3f30f709
GitHub-Last-Rev: 1f27a0e26e
GitHub-Pull-Request: golang/net#54
Reviewed-on: https://go-review.googlesource.com/c/net/+/197599
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Starting with 1.12, we must use syscall versions
of sysctl instead of the raw syscall.
An identical CL will go into the vendored copy of this package in the stdlib.
Change-Id: I6286ab3e49f82512491afb5bcf349e89ab5645ab
Reviewed-on: https://go-review.googlesource.com/c/148597
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
We are no longer able to use the kernel bug for detecting the execution
of 386 emulation on 11.2-RELEASE or above kernels. This change uses a
variable that holds the execution mode detected in init instead.
Change-Id: Ib6afdbc40ae1feb8caf040c64c4b01971efc6325
Reviewed-on: https://go-review.googlesource.com/c/139917
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
On 11.2-RELEASE or above FreeBSD kernels, the breakage of routing
message alignment for 386 emulation (see COMPAT_FREEBSD32 in
sys/net/rtsock.c) is fixed. This change makes packages in the x/net
repository work regardless of the kernel fix.
Change-Id: Ie71cc7dfb842c66225f96d1fb0e8cc5de7c47015
Reviewed-on: https://go-review.googlesource.com/c/139577
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The macOS kernel reliably crashes in a repeated TestRouteMessage.
Putting some extra padding into the request buffer avoids the crash.
This will do as workaround; the kernel bug will be reported to Apple separately.
Fixesgolang/go#22456.
Change-Id: I789d3d57fbc511016d9f4a3fa7662d6c7642f137
Reviewed-on: https://go-review.googlesource.com/73690
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Also makes it possible to capture RTM_DESYNC messages when you have a
routing protocol implementation that requires to be aware of the
health condition of kernel RIB on OpenBSD.
Change-Id: Idd0c8c5e8f5ea72a4d56c9a46c137786bcda6354
Reviewed-on: https://go-review.googlesource.com/50191
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This change drops a workaround for golang.org/issues/13372.
The compiler in Go 1.6 or above handles the "conversion of a
unsafe.Pointer to uintptr when calling syscall.Syscall" case
correctly.
Also fixes a typo.
Change-Id: I0433f3b8f75b34437aad91c6e8cf103e884d2a83
Reviewed-on: https://go-review.googlesource.com/37171
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This change adds the Marshal method of RouteMessage to make it
possible to exchange route messages between userspace processes and
the kernel for the manipulation of routing information base inside the
kernel.
Change-Id: I0cf2c1a391820f41eb9c5eac1c172598cb2e1533
Reviewed-on: https://go-review.googlesource.com/36077
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This change introduces a package that provides the basic manipulation of
routing facilities on BSD variants.
Unlike the existing APIs in syscall package of standard library, the
package tries to provide operating system and its architecture agnostic
APIs. At present, the package supports any version of Darwin, any
version of DragonFly BSD, FreeBSD 7 through 11, NetBSD 6 and above, and
OpenBSD 5.6 and above.
Updates golang/go#14724.
Change-Id: Id964ea22dec491ddac3776e3a8c8c10f140f96ac
Reviewed-on: https://go-review.googlesource.com/22446
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>