Merge branch 'apple' of github.com:fosrl/olm into apple

Former-commit-id: 996c47d8e8
This commit is contained in:
Owen
2025-11-18 14:58:42 -05:00
2 changed files with 10 additions and 5 deletions

View File

@@ -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

View File

@@ -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) {