mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	Be a little bit less verbose on OpenBSD
This commit is contained in:
		
							parent
							
								
									6640b33334
								
							
						
					
					
						commit
						7c0102e43d
					
				
					 1 changed files with 7 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
package yggdrasil
 | 
			
		||||
 | 
			
		||||
import "os/exec"
 | 
			
		||||
import "strings"
 | 
			
		||||
import "unsafe"
 | 
			
		||||
import "syscall"
 | 
			
		||||
import "golang.org/x/sys/unix"
 | 
			
		||||
| 
						 | 
				
			
			@ -90,13 +89,17 @@ func (tun *tunDevice) setupAddress(addr string) error {
 | 
			
		|||
	var err error
 | 
			
		||||
	var ti tuninfo
 | 
			
		||||
 | 
			
		||||
	tun.core.log.Printf("Interface name: %s", tun.iface.Name())
 | 
			
		||||
	tun.core.log.Printf("Interface IPv6: %s", addr)
 | 
			
		||||
	tun.core.log.Printf("Interface MTU: %d", tun.mtu)
 | 
			
		||||
 | 
			
		||||
	// Get the existing interface flags
 | 
			
		||||
	if _, _, errno := unix.Syscall(unix.SYS_IOCTL, uintptr(fd), uintptr(TUNGIFINFO), uintptr(unsafe.Pointer(&ti))); errno != 0 {
 | 
			
		||||
		err = errno
 | 
			
		||||
		tun.core.log.Printf("Error in TUNGIFINFO: %v", errno)
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	tun.core.log.Printf("TUNGIFINFO: %+v", ti)
 | 
			
		||||
	//tun.core.log.Printf("TUNGIFINFO: %+v", ti)
 | 
			
		||||
 | 
			
		||||
	// Set the new MTU
 | 
			
		||||
	ti.tun_mtu = uint16(tun.mtu)
 | 
			
		||||
| 
						 | 
				
			
			@ -112,7 +115,7 @@ func (tun *tunDevice) setupAddress(addr string) error {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	// Set the new interface flags
 | 
			
		||||
	tun.core.log.Printf("TUNSIFINFO: %+v", ti)
 | 
			
		||||
	//tun.core.log.Printf("TUNSIFINFO: %+v", ti)
 | 
			
		||||
	if _, _, errno := unix.Syscall(unix.SYS_IOCTL, uintptr(fd), uintptr(TUNSIFINFO), uintptr(unsafe.Pointer(&ti))); errno != 0 {
 | 
			
		||||
		err = errno
 | 
			
		||||
		tun.core.log.Printf("Error in TUNSIFINFO: %v", errno)
 | 
			
		||||
| 
						 | 
				
			
			@ -121,7 +124,7 @@ func (tun *tunDevice) setupAddress(addr string) error {
 | 
			
		|||
 | 
			
		||||
	// Set address
 | 
			
		||||
	cmd := exec.Command("ifconfig", tun.iface.Name(), "inet6", addr)
 | 
			
		||||
	tun.core.log.Printf("ifconfig command: %v", strings.Join(cmd.Args, " "))
 | 
			
		||||
	//tun.core.log.Printf("ifconfig command: %v", strings.Join(cmd.Args, " "))
 | 
			
		||||
	output, err := cmd.CombinedOutput()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		tun.core.log.Printf("ifconfig failed: %v.", err)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue