Add dummy tun, helper functions

This commit is contained in:
Neil Alexander 2019-01-02 18:05:54 +00:00
parent 53aeca8fa2
commit 4ff3db2309
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
7 changed files with 86 additions and 56 deletions

View file

@ -47,11 +47,13 @@ func (tun *tunAdapter) init(core *Core, send chan<- []byte, recv <-chan []byte)
// Starts the setup process for the TUN/TAP adapter, and if successful, starts
// the read/write goroutines to handle packets on that interface.
func (tun *tunAdapter) start(ifname string, iftapmode bool, addr string, mtu int) error {
if ifname == "none" {
return nil
if ifname != "none" {
if err := tun.setup(ifname, iftapmode, addr, mtu); err != nil {
return err
}
}
if err := tun.setup(ifname, iftapmode, addr, mtu); err != nil {
return err
if ifname == "none" || ifname == "dummy" {
return nil
}
tun.mutex.Lock()
tun.isOpen = true