Disable broadcast mode on *BSD
Keeping it on makes IPv6 problematic and confuses routing daemons.
This commit is contained in:
parent
fc3a7635e5
commit
5079298ce2
|
@ -262,19 +262,6 @@ func CreateTUN(name string, mtu int) (TUNDevice, error) {
|
||||||
return nil, fmt.Errorf("error %s", errno.Error())
|
return nil, fmt.Errorf("error %s", errno.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set TUN iface to broadcast mode. TUN inferfaces on freebsd come up in point to point by default
|
|
||||||
ifmodemode := unix.IFF_BROADCAST
|
|
||||||
_, _, errno = unix.Syscall(
|
|
||||||
unix.SYS_IOCTL,
|
|
||||||
uintptr(tunfd),
|
|
||||||
uintptr(_TUNSIFMODE),
|
|
||||||
uintptr(unsafe.Pointer(&ifmodemode)),
|
|
||||||
)
|
|
||||||
|
|
||||||
if errno != 0 {
|
|
||||||
return nil, fmt.Errorf("error %s", errno.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rename tun interface
|
// Rename tun interface
|
||||||
|
|
||||||
// Open control socket
|
// Open control socket
|
||||||
|
|
|
@ -129,19 +129,6 @@ func CreateTUN(name string, mtu int) (TUNDevice, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set TUN iface to broadcast mode
|
|
||||||
ifmodemode := unix.IFF_BROADCAST
|
|
||||||
_, _, errno := unix.Syscall(
|
|
||||||
unix.SYS_IOCTL,
|
|
||||||
uintptr(tunfile.Fd()),
|
|
||||||
uintptr(_TUNSIFMODE),
|
|
||||||
uintptr(unsafe.Pointer(&ifmodemode)),
|
|
||||||
)
|
|
||||||
|
|
||||||
if errno != 0 {
|
|
||||||
return nil, fmt.Errorf("error %s", errno.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
tun, err := CreateTUNFromFile(tunfile, mtu)
|
tun, err := CreateTUNFromFile(tunfile, mtu)
|
||||||
|
|
||||||
if err == nil && name == "tun" {
|
if err == nil && name == "tun" {
|
||||||
|
|
Loading…
Reference in a new issue