mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Turns out FreeBSD is a bit different so restrict this to OpenBSD for now
This commit is contained in:
		
							parent
							
								
									90393ae03b
								
							
						
					
					
						commit
						24be3f1d67
					
				
					 2 changed files with 16 additions and 10 deletions
				
			
		| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
// +build openbsd freebsd solaris netbsd dragonfly
 | 
					// +build openbsd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package yggdrasil
 | 
					package yggdrasil
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,12 +10,25 @@ import "golang.org/x/sys/unix"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import water "github.com/neilalexander/water"
 | 
					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 TUNSIFINFO = (0x80000000) | ((12 & 0x1fff) << 16) | uint32(byte('t'))<<8 | 91
 | 
				
			||||||
const TUNGIFINFO = (0x40000000) | ((12 & 0x1fff) << 16) | uint32(byte('t'))<<8 | 92
 | 
					const TUNGIFINFO = (0x40000000) | ((12 & 0x1fff) << 16) | uint32(byte('t'))<<8 | 92
 | 
				
			||||||
const SIOCAIFADDR_IN6 = (0x80000000) | ((4 & 0x1fff) << 16) | uint32(byte('i'))<<8 | 27
 | 
					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 {
 | 
					type in6_addrlifetime struct {
 | 
				
			||||||
	ia6t_expire    float64
 | 
						ia6t_expire    float64
 | 
				
			||||||
	ia6t_preferred float64
 | 
						ia6t_preferred float64
 | 
				
			||||||
| 
						 | 
					@ -41,13 +54,6 @@ type in6_aliasreq struct {
 | 
				
			||||||
	ifra_lifetime   in6_addrlifetime
 | 
						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 {
 | 
					func (tun *tunDevice) setup(ifname string, iftapmode bool, addr string, mtu int) error {
 | 
				
			||||||
	var config water.Config
 | 
						var config water.Config
 | 
				
			||||||
	switch {
 | 
						switch {
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
// +build !linux,!darwin,!windows,!openbsd,!freebsd,!solaris,!netbsd,!dragonfly
 | 
					// +build !linux,!darwin,!windows,!openbsd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package yggdrasil
 | 
					package yggdrasil
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue