device: fix nil pointer dereference in uapi read

Signed-off-by: David Anderson <danderson@tailscale.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
David Anderson 2021-11-16 11:27:44 -08:00 committed by Jason A. Donenfeld
parent 111e0566dc
commit 3cae233d69

View file

@ -258,11 +258,11 @@ type ipcSetPeer struct {
} }
func (peer *ipcSetPeer) handlePostConfig() { func (peer *ipcSetPeer) handlePostConfig() {
if peer.Peer == nil { if peer.Peer == nil || peer.dummy {
return return
} }
peer.disableRoaming = peer.device.net.brokenRoaming && peer.endpoint != nil peer.disableRoaming = peer.device.net.brokenRoaming && peer.endpoint != nil
if !peer.dummy && peer.device.isUp() { if peer.device.isUp() {
peer.Start() peer.Start()
if peer.pkaOn { if peer.pkaOn {
peer.SendKeepalive() peer.SendKeepalive()