tun: freebsd: use broadcast mode instead of PPP mode
It makes the routing configuration simpler. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
5f0c8b942d
commit
12ce53271b
@ -292,6 +292,23 @@ func CreateTUN(name string, mtu int) (Device, error) {
|
||||
return nil, fmt.Errorf("Unable to put into IFHEAD mode: %w", errno)
|
||||
}
|
||||
|
||||
// Get out of PPP mode.
|
||||
ifflags := syscall.IFF_BROADCAST
|
||||
tun.operateOnFd(func(fd uintptr) {
|
||||
_, _, errno = unix.Syscall(
|
||||
unix.SYS_IOCTL,
|
||||
fd,
|
||||
uintptr(_TUNSIFMODE),
|
||||
uintptr(unsafe.Pointer(&ifflags)),
|
||||
)
|
||||
})
|
||||
|
||||
if errno != 0 {
|
||||
tunFile.Close()
|
||||
tunDestroy(assignedName)
|
||||
return nil, fmt.Errorf("Unable to put into IFF_BROADCAST mode: %w", errno)
|
||||
}
|
||||
|
||||
// Open control sockets
|
||||
confd, err := unix.Socket(
|
||||
unix.AF_INET,
|
||||
|
Loading…
Reference in New Issue
Block a user