Commit Graph

39 Commits

Author SHA1 Message Date
Meng Zhuo
f428fae207 all: add FreeBSD riscv64 support
For golang/go#53466

Change-Id: Ibbeab43923bdd6b455a28c627832e676b401b4f4
Reviewed-on: https://go-review.googlesource.com/c/net/+/418814
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Goutnik <dgoutnik@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
2022-08-09 01:22:01 +00:00
Ian Lance Taylor
a33c5aa5df route: import syscall rather than golang.org/x/sys/unix
It happens that everything we need is already defined in syscall.
This avoids problems when this package is vendored into the
standard library.

For golang/go#54259

Change-Id: I86bfe44f20c9db2ecfdb8dbb2ef798391da2bfa6
Reviewed-on: https://go-review.googlesource.com/c/net/+/421425
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-08-05 01:37:20 +00:00
Tobias Klauser
f92ba40d43 route: remove RTM_LOCK on openbsd
RTM_LOCK is no longer defined on OpenBSD as of version 6.4, see
https://man.openbsd.org/OpenBSD-6.4/route.4 and
https://marc.info/?l=openbsd-tech&m=153018811429193&w=2

CL 419180 broke the build on openbsd/arm64 and openbsd/mips64 due to
RTM_LOCK not being defined on these platforms because these ports were
based on OpenBSD versions newer than 6.4. Earlier OpenBSD versions are
no longer supported since Go 1.15 per https://golang.org/wiki/OpenBSD

For golang/go#54035

Change-Id: I476a60ab2a082c7ddc763b5dbaf279ba47dcc1e1
Reviewed-on: https://go-review.googlesource.com/c/net/+/419937
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-07-28 18:10:54 +00:00
Meng Zhuo
41545e8bf2 route: drops const that x/unix has
For golang/go#54035

Change-Id: I5163bb1d562f0c7f7de16995fcb42ece894d07bf
Reviewed-on: https://go-review.googlesource.com/c/net/+/419180
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-07-28 03:04:05 +00:00
Ian Lance Taylor
9e5a29745d route: always go through syscall package
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>
2021-11-23 20:28:48 +00:00
Damien Neil
abc453219e route: remove check for unparsed route message bytes
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>
2021-05-25 06:32:56 +00:00
Damien Neil
fe42d452be route: revert routing message alignment for FreeBSD 386 emulation
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.

Fixes golang/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>
2021-05-21 19:59:47 +00:00
Tobias Klauser
4163338589 route: add //go:build line to empty.s
Change-Id: Ife7553d7c9a91e498f87175c147b18c529c89d01
Reviewed-on: https://go-review.googlesource.com/c/net/+/318309
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>
2021-05-10 12:01:50 +00:00
Brad Fitzpatrick
85d9c07bbe route: retry FetchRIB a few times in case data grows
Fixes golang/go#45736

Change-Id: I7e7926ba1a0ff752ba914429c5886ff2be9801a8
Reviewed-on: https://go-review.googlesource.com/c/net/+/313649
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-04-27 23:12:57 +00:00
Russ Cox
5f55cee0dc all: go fmt ./...
Make all our package sources use Go 1.17 gofmt format
(adding //go:build lines).

Not strictly necessary but will avoid spurious changes
as files are edited.

Part of //go:build change (#41184).
See https://golang.org/design/draft-gobuild

Change-Id: I5b2b7d93424e828a3c5f76ae3f30ab825aca388e
Reviewed-on: https://go-review.googlesource.com/c/net/+/294371
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-20 03:31:24 +00:00
Tobias Klauser
05aa5d4ee3 internal/socket, route: drop support for pre-1.12 direct syscalls on darwin
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>
2020-09-25 08:00:53 +00:00
Cherry Zhang
328152dc79 all: add GOOS=ios
Following CL 254740, this CL does it on x/net.

Updates golang/go#38485.

Change-Id: I80831dd0faa6f216d8d3b8f1af0af811aacce43f
Reviewed-on: https://go-review.googlesource.com/c/net/+/255537
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-09-23 18:22:12 +00:00
Ali Farooq
e086a090c8 route: fix spelling of 'represents' in RIBType doc
Change-Id: I5f4ca1a70c90cfa5d8c95ef4d5e8fbfe7f855b1d
GitHub-Last-Rev: 5ada0f59cf
GitHub-Pull-Request: golang/net#69
Reviewed-on: https://go-review.googlesource.com/c/net/+/229224
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2020-04-21 23:12:49 +00:00
Dreamacro
078779b8f2 route: fill correctly field
https://github.com/golang/net/blob/master/route/address.go#L37-L56

Wrong order of filling the buffer

Change-Id: Ia598a1f9aaba03f1c0e9890bcf48ed097eb0a1e6
GitHub-Last-Rev: 1ed3d11bbd
GitHub-Pull-Request: golang/net#60
Reviewed-on: https://go-review.googlesource.com/c/net/+/213117
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-02-22 03:33:25 +00:00
Tobias Klauser
24d2ffbea1 all: fix tests on dragonfly after ABI changes
Detect the ABI version based on kern.osreldate.

Only use 32-bit cmsg alignment for versions before the September 2019
ABI changes:
http://lists.dragonflybsd.org/pipermail/users/2019-September/358280.html

Use RTM_VERSION 7 on Dragonfly master (5.8 release).

Determine sizeof struct ifa_msghdr at runtime based on the ABI version.

Temporarily skip some test relying on the net package which will only be
fixed once this CL is re-vendored into std.

Updates golang/go#34368

Change-Id: I732fab21d569b303f45dfb6a0bbbb11469511a07
Reviewed-on: https://go-review.googlesource.com/c/net/+/202317
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-21 12:47:07 +00:00
Antonio Huete Jimenez
c5a3c61f89 all: adjust defs for Dragonfly BSD
- 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>
2019-09-30 13:41:27 +00:00
Ainar Garipov
a7b16738d8 all: fix typos
Change-Id: I86005e1f17747e4ffe4fc544546e980b987bad36
Reviewed-on: https://go-review.googlesource.com/c/net/+/193799
Reviewed-by: Toshihiro Shiino <shiino.toshihiro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-09-09 00:30:24 +00:00
Tobias Klauser
d28f0bde59 all: follow convention for generated code comment
Follow the convertion (https://golang.org/s/generatedcode) for generated
code.

Change-Id: I3101fb91db42644ead179ffaeffe0211359ac886
Reviewed-on: https://go-review.googlesource.com/c/net/+/182137
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-06-13 19:41:53 +00:00
Mikio Hara
77544e6953 all: make bit clear operator explicitly
Change-Id: If72588778b815bc5d8f3e9f41d888cffc0d2a18d
Reviewed-on: https://go-review.googlesource.com/c/net/+/168298
Run-TryBot: Mikio Hara <mikioh.public.networking@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-03-20 06:12:53 +00:00
Mikio Hara
be1c187aa6 route: update package docs
It's confirmed that this package works on FreeBSD 12-STABLE kernels.

Change-Id: I1f304d3885a351c8c9332b18d6842d1d8d6a66da
Reviewed-on: https://go-review.googlesource.com/c/157277
Run-TryBot: Mikio Hara <mikioh.public.networking@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-10 04:46:37 +00:00
Mikio Hara
1e06a53dbb route: fix TestRouteMessage
We need to be careful once we opened the door to the routing facilities
inside the kernel. Also realigns the query parameters for clarification.

Fixes golang/go#29348.

Change-Id: I3e3379a85e9690a0ad5427ce75503db0795cfb7e
Reviewed-on: https://go-review.googlesource.com/c/155197
Run-TryBot: Mikio Hara <mikioh.public.networking@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2019-01-08 22:56:52 +00:00
Tobias Klauser
1a61f4433d route: add support for freebsd/arm64
This wasn't actually generated on freebsd/arm64 yet. It's mostly a copy
of the amd64 files for now.

Updates golang/go#24715

Change-Id: Iee8c12c29f1d74780948553047bc693668dde0b3
Reviewed-on: https://go-review.googlesource.com/c/156499
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-07 15:51:00 +00:00
Keith Randall
777a393664 route: use libc calls on Darwin
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>
2018-11-14 21:45:02 +00:00
Mikio Hara
146acd28ed route: don't run NET_RT_IFLIST vs. NET_RT_IFLISTL test in 386 emulation (again)
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>
2018-10-05 03:54:20 +00:00
Mikio Hara
68fc911561 route: re-adjust routing message alignment for FreeBSD 386 emulation
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>
2018-10-04 19:43:19 +00:00
Jongmin Kim
4dfa2610cd all: fix typos in comments
Change-Id: Ic1771d3ea0e26e02f71d5f4d1d458eb93a2c016d
Reviewed-on: https://go-review.googlesource.com/137695
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-09-26 15:47:20 +00:00
namusyaka
ae89d30ce0 route: avoid unnecessary type conversions
CL generated mechanically with github.com/mdempsky/unconvert.

Change-Id: I22eea0b991462dd00f3fa28073a8b886e19bc068
Reviewed-on: https://go-review.googlesource.com/100095
Run-TryBot: Kunpei Sakai <namusyaka@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
2018-03-11 17:47:55 +00:00
Russ Cox
7b572d500b route: work around macOS kernel bug
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.

Fixes golang/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>
2017-10-26 23:40:51 +00:00
Mikio Hara
f5079bd7f6 route: make DefaultAddr convey newly added information on OpenBSD
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>
2017-07-26 08:36:32 +00:00
Mikio Hara
ab5485076f route: tweak comment on metric types
Change-Id: I9fb463a5b26e79073a3efc06eea13fd8fcdbf021
Reviewed-on: https://go-review.googlesource.com/50190
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-07-21 03:32:04 +00:00
Mikio Hara
da118f7b8e route: don't fail test when at least one version of INET protocols is available
This is not perfect but is enough for during the dual IP stack era.

Fixes golang/go#19298.

Change-Id: I5f16b10fda5ddfe470edb021d9a6d7e2a642d267
Reviewed-on: https://go-review.googlesource.com/41515
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-24 22:08:42 +00:00
Mikio Hara
6b27048ae5 route: drop support for go1.5
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>
2017-02-18 08:01:59 +00:00
Mikio Hara
b7fd658658 route: fix typo
Change-Id: I954d9a3f97a68c1366e917a4a430dd832227e132
Reviewed-on: https://go-review.googlesource.com/36376
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-06 03:42:19 +00:00
Mikio Hara
41bba8d80b route: add support for the manipulation of routing informaion
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>
2017-02-03 23:23:47 +00:00
Mikio Hara
f09c4662a0 route: fix typo
Change-Id: I41d449e071f1d40bdc69288e7290af168b6b0d3c
Reviewed-on: https://go-review.googlesource.com/29693
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-24 02:07:28 +00:00
Mikio Hara
6d3beaea10 route: test helper code cleanup
Rename method receivers of propVirtual and make the String method of
Inet4Addr use of a pointer receiver.

Change-Id: I422593cf4028d83f856efa55c631f69fdce0514d
Reviewed-on: https://go-review.googlesource.com/28993
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-21 22:18:37 +00:00
Mikio Hara
4d38db7685 route: don't crash or hang up with corrupted messages
Fixes golang/go#16438.

Change-Id: I2a97e57cae298e8eecdd5637c9e03493a449fc62
Reviewed-on: https://go-review.googlesource.com/25070
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-07-20 08:41:39 +00:00
Mikio Hara
fac978cc75 route: fix typos in test
Change-Id: Id0558e3ee71b393e0366c1ae5e022d657fec08f0
Reviewed-on: https://go-review.googlesource.com/23191
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-18 03:10:18 +00:00
Mikio Hara
30be488e91 route: new package
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>
2016-05-14 01:16:38 +00:00