Brad Fitzpatrick
68df379a7d
net/portmapper: rename ErrGatewayNotFound to ErrGatewayRange, reword text
...
It confused & scared people. And it was just bad.
Signed-off-by: Brad Fitzpatrick <[email protected] >
2021-07-26 20:30:28 -07:00
Brad Fitzpatrick
7b295f3d21
net/portmapper: disable UPnP on iOS for now
...
Updates #2495
Signed-off-by: Brad Fitzpatrick <[email protected] >
2021-07-22 13:33:38 -07:00
julianknodt
3a4201e773
net/portmapper: return correct upnp port
...
Previously, this was incorrectly returning the internal port, and using that with the external
exposed IP when it did not use WANIPConnection2. In the case when we must provide a port, we
return it instead.
Noticed this while implementing the integration test for upnp.
Signed-off-by: julianknodt <[email protected] >
2021-07-21 10:11:47 -07:00
Brad Fitzpatrick
171ec9f8f4
control/{controlknobs,controlclient}: simplify knobs API, fix controlclient crash
...
From integration tests elsewhere:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x70 pc=0x845c9b]
goroutine 226 [running]:
tailscale.com/control/controlclient.(*Direct).sendMapRequest(0xc00053e1e0, 0x16670f0, 0xc000353780, 0xffffffffffffffff, 0xc0003e5f10, 0x0, 0x0)
/home/runner/go/pkg/mod/[email protected] /control/controlclient/direct.go:803 +0x19bb
tailscale.com/control/controlclient.(*Direct).PollNetMap(...)
/home/runner/go/pkg/mod/[email protected] /control/controlclient/direct.go:574
tailscale.com/control/controlclient.(*Auto).mapRoutine(0xc00052a1e0)
/home/runner/go/pkg/mod/[email protected] /control/controlclient/auto.go:464 +0x571
created by tailscale.com/control/controlclient.(*Auto).Start
/home/runner/go/pkg/mod/[email protected] /control/controlclient/auto.go:151 +0x65
exit status 2
Also remove types/opt.Bool API addition which is now unnecessary.
Signed-off-by: Brad Fitzpatrick <[email protected] >
2021-07-15 22:34:50 -07:00
julianknodt
1bb6abc604
net/portmapper: add upnp port mapping
...
Add in UPnP portmapping, using goupnp library in order to get the UPnP client and run the
portmapping functions. This rips out anywhere where UPnP used to be in portmapping, and has a
flow separate from PMP and PCP.
RELNOTE=portmapper now supports UPnP mappings
Fixes #682
Updates #2109
Signed-off-by: julianknodt <[email protected] >
2021-07-15 15:22:12 -07:00
Brad Fitzpatrick
92077ae78c
wgengine/magicsock: make portmapping async
...
Signed-off-by: Brad Fitzpatrick <[email protected] >
2021-07-09 11:15:26 -07:00
David Crawshaw
297b3d6fa4
staticcheck.conf: turn off noisy lint errors
...
Signed-off-by: David Crawshaw <[email protected] >
2021-06-18 15:48:20 -07:00
Josh Bleecher Snyder
25df067dd0
all: adapt to opaque netaddr types
...
This commit is a mishmash of automated edits using gofmt:
gofmt -r 'netaddr.IPPort{IP: a, Port: b} -> netaddr.IPPortFrom(a, b)' -w .
gofmt -r 'netaddr.IPPrefix{IP: a, Port: b} -> netaddr.IPPrefixFrom(a, b)' -w .
gofmt -r 'a.IP.Is4 -> a.IP().Is4' -w .
gofmt -r 'a.IP.As16 -> a.IP().As16' -w .
gofmt -r 'a.IP.Is6 -> a.IP().Is6' -w .
gofmt -r 'a.IP.As4 -> a.IP().As4' -w .
gofmt -r 'a.IP.String -> a.IP().String' -w .
And regexps:
\w*(.*)\.Port = (.*) -> $1 = $1.WithPort($2)
\w*(.*)\.IP = (.*) -> $1 = $1.WithIP($2)
And lots of manual fixups.
Signed-off-by: Josh Bleecher Snyder <[email protected] >
2021-05-16 14:52:00 -07:00
David Anderson
6fb5d4080c
net/portmapper: silently handle PCP NOT_AUTHORIZED responses.
...
Fixes #1525 .
Signed-off-by: David Anderson <[email protected] >
2021-03-17 19:44:35 -07:00
Brad Fitzpatrick
44ab0acbdb
net/portmapper, wgengine/monitor: cache gateway IP info until link changes
...
Cuts down allocs & CPU in steady state (on regular STUN probes) when network
is unchanging.
Signed-off-by: Brad Fitzpatrick <[email protected] >
2021-03-15 14:27:39 -07:00
Brad Fitzpatrick
ef7bac2895
tailcfg, net/portmapper, wgengine/magicsock: add NetInfo.HavePortMap
...
Signed-off-by: Brad Fitzpatrick <[email protected] >
2021-03-09 15:17:24 -08:00
Brad Fitzpatrick
63ed4dd6c9
net/portmapper: fix typo
...
Signed-off-by: Brad Fitzpatrick <[email protected] >
2021-03-02 12:26:54 -08:00
Brad Fitzpatrick
c64bd587ae
net/portmapper: add NAT-PMP client, move port mapping service probing
...
* move probing out of netcheck into new net/portmapper package
* use PCP ANNOUNCE op codes for PCP discovery, rather than causing
short-lived (sub-second) side effects with a 1-second-expiring map +
delete.
* track when we heard things from the router so we can be less wasteful
in querying the router's port mapping services in the future
* use portmapper from magicsock to map a public port
Fixes #1298
Fixes #1080
Fixes #1001
Updates #864
Signed-off-by: Brad Fitzpatrick <[email protected] >
2021-02-23 09:07:38 -08:00