You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailscale/net
James Tucker 9ed3a061c3 net/netns: fix segv when no tailscale interface is found
`interfaces.Tailscale()` returns all zero values when it finds no
Tailscale interface and encounters no errors. The netns package was
treating no error as a signal that it would receive a non-zero pointer
value leading to nil pointer dereference.

Observed in:

```
--- FAIL: TestGetInterfaceIndex (0.00s)
    --- FAIL: TestGetInterfaceIndex/IP_and_port (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1029eb7d8]

goroutine 7 [running]:
testing.tRunner.func1.2({0x102a691e0, 0x102bc05c0})
        /Users/raggi/.cache/tailscale-go/src/testing/testing.go:1526 +0x1c8
testing.tRunner.func1()
        /Users/raggi/.cache/tailscale-go/src/testing/testing.go:1529 +0x384
panic({0x102a691e0, 0x102bc05c0})
        /Users/raggi/.cache/tailscale-go/src/runtime/panic.go:884 +0x204
tailscale.com/net/netns.getInterfaceIndex(0x14000073f28, 0x1028d0284?, {0x1029ef3b7, 0xa})
        /Users/raggi/src/github.com/tailscale/tailscale/net/netns/netns_darwin.go:114 +0x228
tailscale.com/net/netns.TestGetInterfaceIndex.func2(0x14000138000)
        /Users/raggi/src/github.com/tailscale/tailscale/net/netns/netns_darwin_test.go:37 +0x54
testing.tRunner(0x14000138000, 0x140000551b0)
        /Users/raggi/.cache/tailscale-go/src/testing/testing.go:1576 +0x10c
created by testing.(*T).Run
        /Users/raggi/.cache/tailscale-go/src/testing/testing.go:1629 +0x368
FAIL    tailscale.com/net/netns 0.824s
```

Fixes #8064

Signed-off-by: James Tucker <jftucker@gmail.com>
1 year ago
..
art net/art: skip tests on CI for now 1 year ago
connstats net/connstats: exclude traffic with internal Tailscale service (#7904) 1 year ago
dns all: avoid repeated default interface lookups 1 year ago
dnscache all: avoid repeated default interface lookups 1 year ago
dnsfallback all: avoid repeated default interface lookups 1 year ago
flowtrack all: update copyright and license headers 1 year ago
interfaces all: move network monitoring from wgengine/monitor to net/netmon 1 year ago
memnet net/memnet: rename from net/nettest 1 year ago
netaddr all: update copyright and license headers 1 year ago
netcheck net/ping,netcheck: add v6 pinging capabilities to pinger (#7971) 1 year ago
neterror net/neterror, wgengine/magicsock: use UDP GSO and GRO on Linux (#7791) 1 year ago
netknob all: update copyright and license headers 1 year ago
netmon all: move network monitoring from wgengine/monitor to net/netmon 1 year ago
netns net/netns: fix segv when no tailscale interface is found 1 year ago
netstat net/{netns,netstat}: use new x/sys/cpu.IsBigEndian 1 year ago
netutil all: replace /kb/ links with /s/ equivalents 1 year ago
packet net/packet: add NAT support for DCCP and GRE 1 year ago
ping net/ping,netcheck: add v6 pinging capabilities to pinger (#7971) 1 year ago
portmapper all: avoid repeated default interface lookups 1 year ago
proxymux all: update copyright and license headers 1 year ago
routetable net/routetable: include unknown flags in the routetable doctor output 1 year ago
socks5 net/socks5: add password auth support 1 year ago
sockstats all: avoid repeated default interface lookups 1 year ago
speedtest all: update copyright and license headers 1 year ago
stun wgengine/magicsock, types/nettype, etc: finish ReadFromUDPAddrPort netip migration 1 year ago
tlsdial health, net/tlsdial: add healthcheck for self-signed cert 1 year ago
tsaddr all: replace /kb/ links with /s/ equivalents 1 year ago
tsdial all: avoid repeated default interface lookups 1 year ago
tshttpproxy net/tshttpproxy: don't proxy through ourselves 1 year ago
tstun tsd: add package with System type to unify subsystem init, discovery 1 year ago
wsconn all: update copyright and license headers 1 year ago