mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-12-24 00:37:49 +00:00
Be a little bit less verbose on OpenBSD
This commit is contained in:
parent
6640b33334
commit
7c0102e43d
@ -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…
x
Reference in New Issue
Block a user