mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
tun: OpenBSD: use proper ioctl API, not raw syscall
Direct syscalls are discouraged and usually do not work. (Not entirely sure why they do with Golang, but that is another story.)
This commit is contained in:
parent
dcec376b7b
commit
93b071e21e
1 changed files with 3 additions and 3 deletions
|
@ -113,9 +113,9 @@ func (tun *TunAdapter) setupAddress(addr string) error {
|
||||||
ar.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME
|
ar.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME
|
||||||
|
|
||||||
// Set the interface address
|
// Set the interface address
|
||||||
if _, _, errno := unix.Syscall(unix.SYS_IOCTL, uintptr(sfd), uintptr(SIOCAIFADDR_IN6), uintptr(unsafe.Pointer(&ar))); errno != 0 {
|
if err = unix.IoctlSetInt(sfd, SIOCAIFADDR_IN6, int(uintptr(unsafe.Pointer(&ar)))); err != nil {
|
||||||
err = errno
|
tun.log.Errorf("Error in SIOCAIFADDR_IN6: %v", err)
|
||||||
tun.log.Errorf("Error in SIOCAIFADDR_IN6: %v", errno)
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue