cmd/tailscale: reset cached config when failing to set up VPN tunnel

Add a bit of logging while here.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
pull/3/head
Elias Naur 5 years ago
parent b297135f2a
commit 31b3c725c8

@ -235,7 +235,7 @@ func (b *backend) updateTUN(service jni.Object, cfg *router.Config) error {
return nil return nil
}) })
if err != nil { if err != nil {
b.lastCfg = cfg b.lastCfg = nil
b.CloseTUNs() b.CloseTUNs()
return err return err
} }

@ -193,6 +193,7 @@ func (a *App) runBackend() error {
if service != 0 { if service != 0 {
if cfg != nil && state.State >= ipn.Starting { if cfg != nil && state.State >= ipn.Starting {
if err := b.updateTUN(service, cfg); err != nil { if err := b.updateTUN(service, cfg); err != nil {
log.Printf("VPN update failed: %v", err)
a.notifyVPNClosed() a.notifyVPNClosed()
} }
} else { } else {
@ -253,6 +254,7 @@ func (a *App) runBackend() error {
} }
if cfg != nil && state.State >= ipn.Starting { if cfg != nil && state.State >= ipn.Starting {
if err := b.updateTUN(service, cfg); err != nil { if err := b.updateTUN(service, cfg); err != nil {
log.Printf("VPN update failed: %v", err)
a.notifyVPNClosed() a.notifyVPNClosed()
} }
} }

Loading…
Cancel
Save