summaryrefslogtreecommitdiff
path: root/src/net/interface_test.go
Commit message (Collapse)AuthorAgeFilesLines
* all: go fix -fix=buildtag std cmd (except for bootstrap deps, vendor)Russ Cox2021-10-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | When these packages are released as part of Go 1.18, Go 1.16 will no longer be supported, so we can remove the +build tags in these files. Ran go fix -fix=buildtag std cmd and then reverted the bootstrapDirs as defined in src/cmd/dist/buildtool.go, which need to continue to build with Go 1.4 for now. Also reverted src/vendor and src/cmd/vendor, which will need to be updated in their own repos first. Manual changes in runtime/pprof/mprof_test.go to adjust line numbers. For #41184. Change-Id: Ic0f93f7091295b6abc76ed5cd6e6746e1280861e Reviewed-on: https://go-review.googlesource.com/c/go/+/344955 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
* all: go fmt std cmd (but revert vendor)Russ Cox2021-02-201-0/+1
| | | | | | | | | | | | | | | | Make all our package sources use Go 1.17 gofmt format (adding //go:build lines). Part of //go:build change (#41184). See https://golang.org/design/draft-gobuild Change-Id: Ia0534360e4957e58cd9a18429c39d0e32a6addb4 Reviewed-on: https://go-review.googlesource.com/c/go/+/294430 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>
* syscall: reenable sysctl on iOSJason A. Donenfeld2019-10-231-14/+0
| | | | | | | | | | | | | | | | | | | | | This was disabled due to a report that the App Store rejects the symbol __sysctl. However, we use the sysctl symbol, which is fine. The __sysctl symbol is used by x/sys/unix, which needs fixing instead. So, this commit reenables sysctl on iOS, so that things like net.InterfaceByName can work again. This reverts CL 193843, CL 193844, CL 193845, and CL 193846. Fixes #35101 Updates #34133 Updates #35103 Change-Id: Ib8eb9f87b81db24965b0de29d99eb52887c7c60a Reviewed-on: https://go-review.googlesource.com/c/go/+/202778 Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* vendor: re-vendor golang.org/x/net to fix Dragonfly buildTobias Klauser2019-10-211-3/+0
| | | | | | | | | | | | | | | | | | | | This picks up CL 202317 which fixes golang.org/x/net for Dragonfly master (upcoming 5.8 release). Also re-enable the interface tests disabled in CL 201482. Vendored using: $ go get golang.org/x/net@24d2ffbea1e8 $ go mod tidy $ go mod vendor Fixes #34368 Change-Id: Iac152b7ffaa607bfedbb4024b4e1ffc9b649d689 Reviewed-on: https://go-review.googlesource.com/c/go/+/202438 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
* net: skip some interface tests on Dragonfly for nowBrad Fitzpatrick2019-10-171-12/+17
| | | | | | | | | | | | Skipping tests isn't great, but neither is a wall of red masking other potential regressions. Updates #34368 Change-Id: I5fdfa54846dd8d648001594c74f059af8af52247 Reviewed-on: https://go-review.googlesource.com/c/go/+/201482 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
* all: remove the nacl port (part 1)Brad Fitzpatrick2019-10-091-1/+1
| | | | | | | | | | | | | | | | | | You were a useful port and you've served your purpose. Thanks for all the play. A subsequent CL will remove amd64p32 (including assembly files and toolchain bits) and remaining bits. The amd64p32 removal will be separated into its own CL in case we want to support the Linux x32 ABI in the future and want our old amd64p32 support as a starting point. Updates #30439 Change-Id: Ia3a0c7d49804adc87bf52a4dea7e3d3007f2b1cd Reviewed-on: https://go-review.googlesource.com/c/go/+/199499 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net,os: disable more sysctl tests on iOSElias Naur2019-09-071-0/+12
| | | | | | | | | Updates #34133 Change-Id: I27c75993176cf876f2d80f70982528258c509b68 Reviewed-on: https://go-review.googlesource.com/c/go/+/193845 Run-TryBot: Elias Naur <mail@eliasnaur.com> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
* all: add new GOOS=illumos, split out of GOOS=solarisJoshua M. Clulow2019-04-301-2/+2
| | | | | | | | | | | | | | | | Like GOOS=android which implies the "linux" build tag, GOOS=illumos implies the "solaris" build tag. This lets the existing ecosystem of packages still work on illumos, but still permits packages to start differentiating between solaris and illumos. Fixes #20603 Change-Id: I8f4eabf1a66060538dca15d7658c1fbc6c826622 Reviewed-on: https://go-review.googlesource.com/c/go/+/174457 Run-TryBot: Benny Siegert <bsiegert@gmail.com> Reviewed-by: Benny Siegert <bsiegert@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: fix TestInterfaceMulticastAddrs for AIXClément Chigot2018-10-231-1/+1
| | | | | | | | | | This commit disables checkMulticastStats for AIX operating system. Change-Id: If8d0fb609a0dcf75b7bb5c3871cfb6fad76a0a92 Reviewed-on: https://go-review.googlesource.com/c/144102 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: add js/wasm architectureRichard Musiol2018-06-041-0/+2
| | | | | | | | | | | | | | | | This commit adds the js/wasm architecture to the net package. The net package is not supported by js/wasm, but a simple fake networking is available so tests of other packages that require basic TCP sockets can pass. The tests of the net package itself are mostly disabled. Updates #18892 Change-Id: Id287200c39f0a3e23d20ef17260ca15ccdcca032 Reviewed-on: https://go-review.googlesource.com/109995 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: adjust the test for IPv4 loopback address blockMikio Hara2018-02-201-1/+1
| | | | | | | | | | | | We live in the era of virtualization and isolation. There is no reason to hesitate to use IPv4 loopback address block for umbrella-type customer accommodating services. Fixes #23903 Change-Id: I990dd98e2651a993dac1b105c0bc771f8631cb93 Reviewed-on: https://go-review.googlesource.com/95336 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: delay IP protocol stack-snooping system callsMikio Hara2017-04-151-3/+3
| | | | | | | | | | | | | | | | | This change delays IP protocol stack-snooping system calls until the start of connection setup for the better experience with some system call auditing, such as seccomp on Linux. See #16789 for examples. Also updates the documentation on favoriteAddrFamily, which is the owner of stack-snooping system calls. Fixes #16789. Change-Id: I4af27bc1ed06ffb1f657b6f6381c328c1f41c66c Reviewed-on: https://go-review.googlesource.com/40750 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: implement network interface API for SolarisMikio Hara2016-10-041-2/+9
| | | | | | | | | Fixes #7177. Change-Id: Iba6063905f4f9c6acef8aba76b55d996f186d835 Reviewed-on: https://go-review.googlesource.com/29892 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
* net: golang.org/x/net/route plumbingMikio Hara2016-05-151-21/+0
| | | | | | | | | | | | | | This change makes use of new routing message APIs for BSD variants to support FreeBSD 11 and newer versions of other BSDs. Fixes #7849. Fixes #14724. Change-Id: I56c7886d6622cdeddd7cc29c8a8062dcc06216d5 Reviewed-on: https://go-review.googlesource.com/22451 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: reorganize interface tests to avoid vague flakinessMikio Hara2016-05-111-127/+165
| | | | | | | | | | | This change reorganizes test cases for surveying network interfaces and address prefixes to make sure which part of the functionality is broken. Updates #7849. Change-Id: If6918075802eef69a7f1ee040010b3c46f4f4b97 Reviewed-on: https://go-review.googlesource.com/22990 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* Revert "net: add support for Zone of IPNet"Mikio Hara2016-05-061-5/+1
| | | | | | | | | | | | | Updates #14518. This reverts commit 3e9264c9ae781a2cd28127deaed6ae26f84b4b15. Change-Id: I2531b04efc735b5b51ef675541172f2f5ae747d9 Reviewed-on: https://go-review.googlesource.com/22836 Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com> Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: add support for Zone of IPNetMikio Hara2016-04-191-1/+5
| | | | | | | | | | | | | This change adds Zone field to IPNet structure for making it possible to determine which network interface is associated with IPv6 link-local address. Also makes ParseCIDR and IPNet.String capable handling literal IPv6 address prefixes with zone identifier. Fixes #14518. Change-Id: I8f8a40d3b4f500ffef25728d4995651379d8408a Reviewed-on: https://go-review.googlesource.com/19946 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: relax TestInterfaces and TestInterfaceAddrs for BSD variantsMikio Hara2016-04-151-2/+8
| | | | | | | | Fixes #15249. Change-Id: I91fc3d6a2df294b21a67d085da6fe661827a850e Reviewed-on: https://go-review.googlesource.com/22079 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: skip failing or flaky TestInterfaces on freebsd-armBrad Fitzpatrick2016-04-121-0/+5
| | | | | | | | | Updates #15262 Change-Id: I3eb1f6f71d6285d039f11ba6a34b8a599a33bf49 Reviewed-on: https://go-review.googlesource.com/21909 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* all: single space after period.Brad Fitzpatrick2016-03-021-1/+1
| | | | | | | | | | | | | | | | | | | | 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. This means contributors won't be confused by misleading precedence. This CL doesn't use go/doc to parse. It only addresses // comments. It was generated with: $ perl -i -npe 's,^(\s*// .+[a-z]\.) +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.) +([A-Z])') $ go test go/doc -update Change-Id: Iccdb99c37c797ef1f804a94b22ba5ee4b500c4f7 Reviewed-on: https://go-review.googlesource.com/20022 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Dave Day <djd@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* all: make copyright headers consistent with one space after periodBrad Fitzpatrick2016-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | This is a subset of https://golang.org/cl/20022 with only the copyright header lines, so the next CL will be smaller and more reviewable. 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. Change-Id: Icc26c6b8495c3820da6b171ca96a74701b4a01b0 Reviewed-on: https://go-review.googlesource.com/20111 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* all: fix typos and spellingMartin Möhrmann2016-02-241-2/+2
| | | | | | | | Change-Id: Icd06d99c42b8299fd931c7da821e1f418684d913 Reviewed-on: https://go-review.googlesource.com/19829 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: make use of IPv4 for parsing routing information on windowsMikio Hara2015-12-191-2/+14
| | | | | | | | | | | | | | | | | In general the package net deals IPv4 addresses as IPv6 IPv4-mapped addresses internally for the dual stack era, when we need to support various techniques on IPv4/IPv6 translation. This change makes windows implementation follow the same pattern which BSD variants and Linux do. Updates #13544. Also fixes an unintentionally formatted line by accident by gofmt. Change-Id: I4953796e751fd8050c73094468a0d7b0d33f5516 Reviewed-on: https://go-review.googlesource.com/17992 Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
* net, internal/syscall/windows: fix interface and address identification on ↵Mikio Hara2015-12-101-4/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | windows The current implementation including Go 1.5 through 1.5.2 misuses Windows API and mishandles the returned values from GetAdapterAddresses on Windows. This change fixes various issues related to network facility information by readjusting interface and interface address parsers. Updates #5395. Updates #10530. Updates #12301. Updates #12551. Updates #13542. Fixes #12691. Fixes #12811. Fixes #13476. Fixes #13544. Also fixes fragile screen scraping test cases in net_windows_test.go. Additional information for reviewers: It seems like almost all the issues above have the same root cause and it is misunderstanding of Windows API. If my interpretation of the information on MSDN is correctly, current implementation contains the following bugs: - SIO_GET_INTERFACE_LIST should not be used for IPv6. The behavior of SIO_GET_INTERFACE_LIST is different on kernels and probably it doesn't work correctly for IPv6 on old kernels such as Windows XP w/ SP2. Unfortunately MSDN doesn't describe the detail of SIO_GET_INTERFACE_LIST, but information on the net suggests so. - Fetching IP_ADAPTER_ADDRESSES structures with fixed size area may not work when using IPv6. IPv6 generates ton of interface addresses for various addressing scopes. We need to adjust the area appropriately. - PhysicalAddress field of IP_ADAPTER_ADDRESSES structure may have extra space. We cannot ignore PhysicalAddressLength field of IP_ADAPTER_ADDRESS structure. - Flags field of IP_ADAPTER_ADDRESSES structure doesn't represent any of administratively and operatinal statuses. It just represents settings for windows network adapter. - MTU field of IP_ADAPTER_ADDRESSES structure may have a uint32(-1) on 64-bit platform. We need to convert the value to interger appropriately. - IfType field of IP_ADAPTER_ADDRESSES structure is not a bit field. Bitwire operation for the field is completely wrong. - OperStatus field of IP_ADAPTER_ADDRESSES structure is not a bit field. Bitwire operation for the field is completely wrong. - IPv6IfIndex field of IP_ADAPTER_ADDRESSES structure is just a substitute for IfIndex field. We cannot prefer IPv6IfIndex to IfIndex. - Windows XP, 2003 server and below don't set OnLinkPrefixLength field of IP_ADAPTER_UNICAST_ADDRESS structure. We cannot rely on the field on old kernels. We can use FirstPrefix field of IP_ADAPTER_ADDRESSES structure and IP_ADAPTER_PREFIX structure instead. - Length field of IP_ADAPTER_{UNICAST,ANYCAST,MULTICAST}_ADDRESS sturecures doesn't represent an address prefix length. It just represents a socket address length. Change-Id: Icabdaf7bd1d41360a981d2dad0b830b02b584528 Reviewed-on: https://go-review.googlesource.com/17412 Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
* net: simplify sync.Once calls in testsMikio Hara2015-05-141-6/+6
| | | | | | Change-Id: I0c2e1a4a8261887a696e585dda46e72d691191e0 Reviewed-on: https://go-review.googlesource.com/10070 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: fix data race in benchmarksMikio Hara2015-04-011-12/+6
| | | | | | | | Fixes #10307. Change-Id: If70f36a6f1c4e465a47a0bc4d38b318424111106 Reviewed-on: https://go-review.googlesource.com/8330 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: add socket system call hooks for testingMikio Hara2015-03-311-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds socket system call hooks to existing test cases for simulating a bit complicated network conditions to help making timeout and dual IP stack test cases work more properly in followup changes. Also test cases print debugging information in non-short mode like the following: Leaked goroutines: net.TestWriteTimeout.func2(0xc20802a5a0, 0xc20801d000, 0x1000, 0x1000, 0xc2081d2ae0) /go/src/net/timeout_test.go:170 +0x98 created by net.TestWriteTimeout /go/src/net/timeout_test.go:173 +0x745 net.runDatagramPacketConnServer(0xc2080730e0, 0x2bd270, 0x3, 0x2c1770, 0xb, 0xc2081d2ba0, 0xc2081d2c00) /go/src/net/server_test.go:398 +0x667 created by net.TestTimeoutUDP /go/src/net/timeout_test.go:247 +0xc9 (snip) Leaked sockets: 3: {Cookie:615726511685632 Err:<nil> SocketErr:0} 5: {Cookie:7934075906097152 Err:<nil> SocketErr:0} Socket statistical information: {Family:1 Type:805306370 Protocol:0 Opened:17 Accepted:0 Connected:5 Closed:17} {Family:2 Type:805306369 Protocol:0 Opened:450 Accepted:234 Connected:279 Closed:636} {Family:1 Type:805306369 Protocol:0 Opened:11 Accepted:5 Connected:5 Closed:16} {Family:28 Type:805306369 Protocol:0 Opened:95 Accepted:22 Connected:16 Closed:116} {Family:2 Type:805306370 Protocol:0 Opened:84 Accepted:0 Connected:34 Closed:83} {Family:28 Type:805306370 Protocol:0 Opened:52 Accepted:0 Connected:4 Closed:52} Change-Id: I0e84be59a0699bc31245c78e2249423459b8cdda Reviewed-on: https://go-review.googlesource.com/6390 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: fix TestInterfaces, TestInterfaceAddrs on platforms without loopback ↵Mikio Hara2015-03-231-25/+58
| | | | | | | | | | | interface Fixes #10214. Change-Id: If29d26c590eb53d4976e0a6ace0ed33aaf0c3e80 Reviewed-on: https://go-review.googlesource.com/7924 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
* syscall: fix parsing ipv6 address prefix on dragonflyMikio Hara2015-03-031-6/+0
| | | | | | | | | | | | | | This change fixes a missing case that a routing address contains an invalid address family label but it holds a valid length of address structure. Also makes test robust. Fixes #10041. Change-Id: I2480ba273929e859896697382d1a75b01a116b98 Reviewed-on: https://go-review.googlesource.com/6391 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: disable failing interface tests on dragonflyRuss Cox2015-03-011-0/+6
| | | | | | | | (Issue #10041.) Change-Id: Ia894ab60ac6b09926c684f99aacca79275cbced4 Reviewed-on: https://go-review.googlesource.com/6365 Reviewed-by: Russ Cox <rsc@golang.org>
* net: re-implement Interfaces and InterfaceAddrs for IPNet, IPv6 on Windowsmattn2015-02-101-10/+1
| | | | | | | | Fixes #5395 Change-Id: I4322bc8a974d04d9bae6b48c71c5d32d9252973c Reviewed-on: https://go-review.googlesource.com/3024 Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
* net: update test cases for network interface APIMikio Hara2015-01-281-51/+109
| | | | | | | | | This change extends existing test case to Windows for helping to fix golang.org/issue/5395. Change-Id: Iff077fa98ede511981df513f48d84c19375b3e04 Reviewed-on: https://go-review.googlesource.com/3304 Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
* build: move package sources from src/pkg to srcRuss Cox2014-09-081-0/+211
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.