wgengine/magicsock: fix js/wasm crash regression loading non-existent portmapper
Thanks for the report, @Need-an-AwP! Fixes #17681 Updates #9394 Change-Id: I2e0b722ef9b460bd7e79499192d1a315504ca84c Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
0a5ba8280f
commit
edb11e0e60
@@ -719,9 +719,13 @@ func NewConn(opts Options) (*Conn, error) {
|
||||
newPortMapper, ok := portmappertype.HookNewPortMapper.GetOk()
|
||||
if ok {
|
||||
c.portMapper = newPortMapper(portmapperLogf, opts.EventBus, opts.NetMon, disableUPnP, c.onlyTCP443.Load)
|
||||
} else if !testenv.InTest() {
|
||||
panic("unexpected: HookNewPortMapper not set")
|
||||
}
|
||||
// If !ok, the HookNewPortMapper hook is not set (so feature/portmapper
|
||||
// isn't linked), but the build tag to explicitly omit the portmapper
|
||||
// isn't set either. This should only happen to js/wasm builds, where
|
||||
// the portmapper is a no-op even if linked (but it's no longer linked,
|
||||
// since the move to feature/portmapper), or if people are wiring up
|
||||
// their own Tailscale build from pieces.
|
||||
}
|
||||
|
||||
c.netMon = opts.NetMon
|
||||
|
||||
Reference in New Issue
Block a user