Skip to content

Commit 976bf24

Browse files
committed
ipn/ipnlocal: remove the always-true CanSupportNetworkLock()
Now that we support using an in-memory backend for TKA state (tailscale#17946), this function always returns `nil` – we can always support Network Lock. We don't need it any more. Plus, clean up a couple of errant TODOs from that PR. Updates tailscale/corp#33599 Change-Id: Ief93bb9adebb82b9ad1b3e406d1ae9d2fa234877 Signed-off-by: Alex Chan <[email protected]>
1 parent 6ac4356 commit 976bf24

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

ipn/ipnlocal/network-lock.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,6 @@ func (b *LocalBackend) tkaSyncIfNeeded(nm *netmap.NetworkMap, prefs ipn.PrefsVie
300300
return nil
301301
}
302302

303-
if err := b.CanSupportNetworkLock(); err != nil {
304-
return err
305-
}
306-
307303
isEnabled := b.tka != nil
308304
wantEnabled := nm.TKAEnabled
309305

@@ -488,10 +484,6 @@ func (b *LocalBackend) chonkPathLocked() string {
488484
//
489485
// b.mu must be held.
490486
func (b *LocalBackend) tkaBootstrapFromGenesisLocked(g tkatype.MarshaledAUM, persist persist.PersistView) error {
491-
if err := b.CanSupportNetworkLock(); err != nil {
492-
return err
493-
}
494-
495487
var genesis tka.AUM
496488
if err := genesis.Unserialize(g); err != nil {
497489
return fmt.Errorf("reading genesis: %v", err)
@@ -537,20 +529,6 @@ func (b *LocalBackend) tkaBootstrapFromGenesisLocked(g tkatype.MarshaledAUM, per
537529
return nil
538530
}
539531

540-
// CanSupportNetworkLock returns nil if tailscaled is able to operate
541-
// a local tailnet key authority (and hence enforce network lock).
542-
func (b *LocalBackend) CanSupportNetworkLock() error {
543-
if b.tka != nil {
544-
// If the TKA is being used, it is supported.
545-
return nil
546-
}
547-
548-
// There's a var root (aka --statedir), so if network lock gets
549-
// initialized we have somewhere to store our AUMs. That's all
550-
// we need.
551-
return nil
552-
}
553-
554532
// NetworkLockStatus returns a structure describing the state of the
555533
// tailnet key authority, if any.
556534
func (b *LocalBackend) NetworkLockStatus() *ipnstate.NetworkLockStatus {
@@ -664,12 +642,7 @@ func tkaStateFromPeer(p tailcfg.NodeView) ipnstate.TKAPeer {
664642
// needing signatures is returned as a response.
665643
// The Finish RPC submits signatures for all these nodes, at which point
666644
// Control has everything it needs to atomically enable network lock.
667-
// TODO(alexc): Only with persistent backend
668645
func (b *LocalBackend) NetworkLockInit(keys []tka.Key, disablementValues [][]byte, supportDisablement []byte) error {
669-
if err := b.CanSupportNetworkLock(); err != nil {
670-
return err
671-
}
672-
673646
var ourNodeKey key.NodePublic
674647
var nlPriv key.NLPrivate
675648

@@ -794,7 +767,6 @@ func (b *LocalBackend) NetworkLockForceLocalDisable() error {
794767

795768
// NetworkLockSign signs the given node-key and submits it to the control plane.
796769
// rotationPublic, if specified, must be an ed25519 public key.
797-
// TODO(alexc): in-memory only
798770
func (b *LocalBackend) NetworkLockSign(nodeKey key.NodePublic, rotationPublic []byte) error {
799771
ourNodeKey, sig, err := func(nodeKey key.NodePublic, rotationPublic []byte) (key.NodePublic, tka.NodeKeySignature, error) {
800772
b.mu.Lock()

0 commit comments

Comments
 (0)