mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-10-31 09:15:07 +03:00 
			
		
		
		
	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)).
This commit is contained in:
		
							parent
							
								
									2c7e7be036
								
							
						
					
					
						commit
						32b4c58f74
					
				
					 1 changed files with 0 additions and 10 deletions
				
			
		|  | @ -6,7 +6,6 @@ package tun | ||||||
| import ( | import ( | ||||||
| 	"encoding/binary" | 	"encoding/binary" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"os/exec" |  | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" | 	"strings" | ||||||
| 	"syscall" | 	"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 { | 	if _, _, errno := unix.Syscall(unix.SYS_IOCTL, uintptr(sfd), uintptr(SIOCSIFADDR_IN6), uintptr(unsafe.Pointer(&ar))); errno != 0 { | ||||||
| 		err = errno | 		err = errno | ||||||
| 		tun.log.Errorf("Error in SIOCSIFADDR_IN6: %v", 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 | 	return nil | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Klemens Nanni
						Klemens Nanni