5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-12-22 18:45:40 +00:00

Turns out FreeBSD is a bit different so restrict this to OpenBSD for now

This commit is contained in:
Neil Alexander 2018-03-01 15:11:12 +00:00
parent 90393ae03b
commit 24be3f1d67
2 changed files with 16 additions and 10 deletions

View File

@ -1,4 +1,4 @@
// +build openbsd freebsd solaris netbsd dragonfly
// +build openbsd
package yggdrasil
@ -10,12 +10,25 @@ import "golang.org/x/sys/unix"
import water "github.com/neilalexander/water"
// This is to catch BSD platforms
// This is to catch OpenBSD
// Warning! When porting this to other BSDs, the tuninfo struct can appear with
// the fields in a different order, and the consts below might also have
// different values
type tuninfo struct {
tun_mtu uint16
tun_type uint32
tun_flags uint32
tun_dummy uint16
}
const TUNSIFINFO = (0x80000000) | ((12 & 0x1fff) << 16) | uint32(byte('t'))<<8 | 91
const TUNGIFINFO = (0x40000000) | ((12 & 0x1fff) << 16) | uint32(byte('t'))<<8 | 92
const SIOCAIFADDR_IN6 = (0x80000000) | ((4 & 0x1fff) << 16) | uint32(byte('i'))<<8 | 27
// Below this point seems to be fairly standard at least...
type in6_addrlifetime struct {
ia6t_expire float64
ia6t_preferred float64
@ -41,13 +54,6 @@ type in6_aliasreq struct {
ifra_lifetime in6_addrlifetime
}
type tuninfo struct {
tun_mtu uint16
tun_type uint32
tun_flags uint32
tun_dummy uint16
}
func (tun *tunDevice) setup(ifname string, iftapmode bool, addr string, mtu int) error {
var config water.Config
switch {

View File

@ -1,4 +1,4 @@
// +build !linux,!darwin,!windows,!openbsd,!freebsd,!solaris,!netbsd,!dragonfly
// +build !linux,!darwin,!windows,!openbsd
package yggdrasil