wgengine: pass tun.NativeDevice to router

Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com>
pull/395/head
Dmytro Shynkevych 5 years ago committed by Dmytro Shynkevych
parent 9c914dc7dd
commit 635f7b99f1

@ -262,3 +262,8 @@ func (t *TUN) InjectOutbound(packet []byte) error {
return nil return nil
} }
} }
// Unwrap returns the underlying TUN device.
func (t *TUN) Unwrap() tun.Device {
return t.tdev
}

@ -206,7 +206,9 @@ func newUserspaceEngineAdvanced(logf logger.Logf, tundev *tstun.TUN, routerGen R
} }
}() }()
e.router, err = routerGen(logf, e.wgdev, e.tundev) // Pass the underlying tun.(*NativeDevice) to the router:
// routers do not Read or Write, but do access native interfaces.
e.router, err = routerGen(logf, e.wgdev, e.tundev.Unwrap())
if err != nil { if err != nil {
return nil, err return nil, err
} }

Loading…
Cancel
Save