wgengine: don't pass nil router.Config objects.

These are hard for swift to decode in the iOS app.

Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>
pull/427/head
Avery Pennarun 4 years ago
parent 5114df415e
commit f0b6ba78e8

@ -868,7 +868,7 @@ func (b *LocalBackend) enterState(newState State) {
b.blockEngineUpdates(true)
fallthrough
case Stopped:
err := b.e.Reconfig(&wgcfg.Config{}, nil)
err := b.e.Reconfig(&wgcfg.Config{}, &router.Config{})
if err != nil {
b.logf("Reconfig(down): %v", err)
}
@ -958,7 +958,7 @@ func (b *LocalBackend) stateMachine() {
// a status update that predates the "I've shut down" update.
func (b *LocalBackend) stopEngineAndWait() {
b.logf("stopEngineAndWait...")
b.e.Reconfig(&wgcfg.Config{}, nil)
b.e.Reconfig(&wgcfg.Config{}, &router.Config{})
b.requestEngineStatusAndWait()
b.logf("stopEngineAndWait: done.")
}

@ -11,6 +11,7 @@ import (
)
type darwinRouter struct {
logf logger.Logf
tunname string
}
@ -19,7 +20,10 @@ func newUserspaceRouter(logf logger.Logf, _ *device.Device, tundev tun.Device) (
if err != nil {
return nil, err
}
return &darwinRouter{tunname: tunname}, nil
return &darwinRouter{
logf: logf,
tunname: tunname,
}, nil
}
func (r *darwinRouter) Up() error {

@ -370,6 +370,10 @@ func configSignature(cfg *wgcfg.Config, routerCfg *router.Config) (string, error
}
func (e *userspaceEngine) Reconfig(cfg *wgcfg.Config, routerCfg *router.Config) error {
if routerCfg == nil {
panic("routerCfg must not be nil")
}
e.wgLock.Lock()
defer e.wgLock.Unlock()

Loading…
Cancel
Save