wgengine/wgcfg/nmcfg: don't configure peers who can't DERP or disco.

Fixes #2770

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson 2021-09-01 15:29:06 -07:00 committed by Dave Anderson
parent f90ac11bd8
commit 954064bdfe

View File

@ -69,6 +69,12 @@ func WGCfg(nm *netmap.NetworkMap, logf logger.Logf, flags netmap.WGConfigFlags,
if controlclient.Debug.OnlyDisco && peer.DiscoKey.IsZero() { if controlclient.Debug.OnlyDisco && peer.DiscoKey.IsZero() {
continue continue
} }
if peer.DiscoKey.IsZero() && peer.DERP == "" {
// Peer predates both DERP and active discovery, we cannot
// communicate with it.
logf("[v1] wgcfg: skipped peer %s, doesn't offer DERP or disco", peer.Key.ShortString())
continue
}
cfg.Peers = append(cfg.Peers, wgcfg.Peer{ cfg.Peers = append(cfg.Peers, wgcfg.Peer{
PublicKey: wgkey.Key(peer.Key), PublicKey: wgkey.Key(peer.Key),
DiscoKey: peer.DiscoKey, DiscoKey: peer.DiscoKey,