net/portmapper: fix nil pointer dereference in Client.createMapping

The EventBus in net/portmapper.Config is still optional and Client.updates can be nil.

Updates #15772

Signed-off-by: Nick Khyl <nickk@tailscale.com>
main
Nick Khyl 1 year ago committed by Nick Khyl
parent c28fda864a
commit c41a2d5c83
  1. 12
      net/portmapper/portmapper.go

@ -508,11 +508,13 @@ func (c *Client) createMapping() {
} }
return return
} }
c.updates.Publish(Mapping{ if c.updates != nil {
External: mapping.External(), c.updates.Publish(Mapping{
Type: mapping.MappingType(), External: mapping.External(),
GoodUntil: mapping.GoodUntil(), Type: mapping.MappingType(),
}) GoodUntil: mapping.GoodUntil(),
})
}
if c.onChange != nil { if c.onChange != nil {
go c.onChange() go c.onChange()
} }

Loading…
Cancel
Save