From 32b4c58f74042bf4e066d138b16635864c4c248f Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Sun, 29 Sep 2024 23:21:11 +0300 Subject: [PATCH] tun: OpenBSD: remove ifconfig fallback Start by deleting stuff we will not need or want in the end. This also seems to be the only code doing execve(2), which is best to be prevented from ever being called via pledge(2), but that is another story (I am already running yggdrasil with pledge(2) and unveil(2)). --- src/tun/tun_openbsd.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/tun/tun_openbsd.go b/src/tun/tun_openbsd.go index cd02221f..f10342af 100644 --- a/src/tun/tun_openbsd.go +++ b/src/tun/tun_openbsd.go @@ -6,7 +6,6 @@ package tun import ( "encoding/binary" "fmt" - "os/exec" "strconv" "strings" "syscall" @@ -96,15 +95,6 @@ func (tun *TunAdapter) setupAddress(addr string) error { if _, _, errno := unix.Syscall(unix.SYS_IOCTL, uintptr(sfd), uintptr(SIOCSIFADDR_IN6), uintptr(unsafe.Pointer(&ar))); errno != 0 { err = errno tun.log.Errorf("Error in SIOCSIFADDR_IN6: %v", errno) - - // Fall back to ifconfig to set the address - cmd := exec.Command("ifconfig", tun.Name(), "inet6", addr) - tun.log.Warnf("Using ifconfig as fallback: %v", strings.Join(cmd.Args, " ")) - output, err := cmd.CombinedOutput() - if err != nil { - tun.log.Errorf("SIOCSIFADDR_IN6 fallback failed: %v.", err) - tun.log.Traceln(string(output)) - } } return nil