From aa866493aa77db5f4a9ec0a4e3acc439da2c874f Mon Sep 17 00:00:00 2001 From: miloschwartz Date: Tue, 18 Nov 2025 14:52:44 -0500 Subject: [PATCH] testing Former-commit-id: 1a7aba8bbe6d0242b12a7212cf8eb461e6a12d4f --- olm/interface.go | 4 ---- olm/unix.go | 11 ++++++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/olm/interface.go b/olm/interface.go index ab4b4fb..873ea95 100644 --- a/olm/interface.go +++ b/olm/interface.go @@ -16,10 +16,6 @@ import ( // ConfigureInterface configures a network interface with an IP address and brings it up func ConfigureInterface(interfaceName string, wgData WgData) error { - if interfaceName == "" { - return nil - } - var ipAddr string = wgData.TunnelIP // Parse the IP address and network diff --git a/olm/unix.go b/olm/unix.go index ffdf7e9..06eb5c4 100644 --- a/olm/unix.go +++ b/olm/unix.go @@ -18,12 +18,21 @@ func createTUNFromFD(tunFd uint32, mtuInt int) (tun.Device, error) { logger.Error("Unable to dup tun fd: %v", err) return nil, err } + err = unix.SetNonblock(dupTunFd, true) if err != nil { + unix.Close(dupTunFd) return nil, err } - return tun.CreateTUNFromFile(os.NewFile(uintptr(dupTunFd), "/dev/tun"), mtuInt) + file := os.NewFile(uintptr(dupTunFd), "/dev/tun") + device, err := tun.CreateTUNFromFile(file, mtuInt) + if err != nil { + file.Close() + return nil, err + } + + return device, nil } func uapiOpen(interfaceName string) (*os.File, error) {