yggdrasil-go icon indicating copy to clipboard operation
yggdrasil-go copied to clipboard

An error occured starting TUN/TAP: file exists [BUG][SOLUTION]

Open proukornew opened this issue 3 years ago • 0 comments

#530 years have passed, but u didn't fix this bug. Yggdrasil tries to manage unmanaged interface by itself. But there are others entities to do this job. ​e.g. Openwrt system has race condition on ygg0 static configuration. (9/10 runs An error occured starting TUN/TAP: file exists)

Please, make config's option to skip this job. The bug is located here:

if err := tun.setup(tun.config.IfName, addr, mtu); err != nil {
		return err
	}
	if tun.MTU() != mtu {
		tun.log.Warnf("Warning: Interface MTU %d automatically adjusted to %d (supported range is 1280-%d)", tun.config.IfMTU, tun.MTU(), MaximumMTU())
	}
	tun.rwc.SetMTU(tun.MTU())
	tun.isOpen = true
	tun.isEnabled = true
	go tun.read()
	go tun.write()
	return nil

Return error and skip all useful stuff without Panic... lolwut? try something like that:

if err := tun.setup(tun.config.IfName, addr, mtu); err != nil {
		if err != "file exists" {
                    return err
                }
	}

proukornew avatar Jan 29 '22 10:01 proukornew