mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 05:37:32 +00:00
net/tstun: add start of Linux TAP support, with DHCP+ARP server
Still very much a prototype (hard-coded IPs, etc) but should be non-invasive enough to submit at this point and iterate from here. Updates #2589 Co-Author: David Crawshaw <crawshaw@tailscale.com> Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
fd7b738e5b
commit
a729070252
@@ -149,6 +149,10 @@ type Config struct {
|
||||
// If nil, a fake Device that does nothing is used.
|
||||
Tun tun.Device
|
||||
|
||||
// IsTAP is whether Tun is actually a TAP (Layer 2) device that'll
|
||||
// require ethernet headers.
|
||||
IsTAP bool
|
||||
|
||||
// Router interfaces the Engine to the OS network stack.
|
||||
// If nil, a fake Router that does nothing is used.
|
||||
Router router.Router
|
||||
@@ -235,7 +239,12 @@ func NewUserspaceEngine(logf logger.Logf, conf Config) (_ Engine, reterr error)
|
||||
conf.DNS = d
|
||||
}
|
||||
|
||||
tsTUNDev := tstun.Wrap(logf, conf.Tun)
|
||||
var tsTUNDev *tstun.Wrapper
|
||||
if conf.IsTAP {
|
||||
tsTUNDev = tstun.WrapTAP(logf, conf.Tun)
|
||||
} else {
|
||||
tsTUNDev = tstun.Wrap(logf, conf.Tun)
|
||||
}
|
||||
closePool.add(tsTUNDev)
|
||||
|
||||
e := &userspaceEngine{
|
||||
|
Reference in New Issue
Block a user