mirror of https://github.com/slackhq/nebula.git
Fix rebind to not put the socket in blocking mode (#972)
This commit is contained in:
parent
d271df8da8
commit
f7e392995a
|
@ -43,10 +43,15 @@ func NewListenConfig(multi bool) net.ListenConfig {
|
|||
}
|
||||
|
||||
func (u *GenericConn) Rebind() error {
|
||||
file, err := u.File()
|
||||
rc, err := u.UDPConn.SyscallConn()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return syscall.SetsockoptInt(int(file.Fd()), unix.IPPROTO_IPV6, unix.IPV6_BOUND_IF, 0)
|
||||
return rc.Control(func(fd uintptr) {
|
||||
err := syscall.SetsockoptInt(int(fd), unix.IPPROTO_IPV6, unix.IPV6_BOUND_IF, 0)
|
||||
if err != nil {
|
||||
u.l.WithError(err).Error("Failed to rebind udp socket")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue