mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
tun: OpenBSD: set address lifetime
At this point, the ioctl success without any error, but no address appears on the interface. Turns out telling NDP to not expire helps. Congrats, yggdrasil is now operational on OpenBSD.
This commit is contained in:
parent
94ed9445df
commit
dcec376b7b
1 changed files with 7 additions and 1 deletions
|
@ -14,7 +14,10 @@ import (
|
||||||
wgtun "golang.zx2c4.com/wireguard/tun"
|
wgtun "golang.zx2c4.com/wireguard/tun"
|
||||||
)
|
)
|
||||||
|
|
||||||
const SIOCAIFADDR_IN6 = 0x8080691a
|
const (
|
||||||
|
SIOCAIFADDR_IN6 = 0x8080691a
|
||||||
|
ND6_INFINITE_LIFETIME = 0xffffffff
|
||||||
|
)
|
||||||
|
|
||||||
type in6_addrlifetime struct {
|
type in6_addrlifetime struct {
|
||||||
ia6t_expire int64
|
ia6t_expire int64
|
||||||
|
@ -106,6 +109,9 @@ func (tun *TunAdapter) setupAddress(addr string) error {
|
||||||
prefixmask := net.CIDRMask(prefix.Mask.Size())
|
prefixmask := net.CIDRMask(prefix.Mask.Size())
|
||||||
ar.ifra_prefixmask.setSockaddr(prefixmask)
|
ar.ifra_prefixmask.setSockaddr(prefixmask)
|
||||||
|
|
||||||
|
ar.ifra_lifetime.ia6t_vltime = 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 _, _, errno := unix.Syscall(unix.SYS_IOCTL, uintptr(sfd), uintptr(SIOCAIFADDR_IN6), uintptr(unsafe.Pointer(&ar))); errno != 0 {
|
||||||
err = errno
|
err = errno
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue