|
|
@ -3,6 +3,7 @@ package internet
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
"net"
|
|
|
|
"syscall"
|
|
|
|
"syscall"
|
|
|
|
|
|
|
|
|
|
|
|
"golang.org/x/sys/unix"
|
|
|
|
"golang.org/x/sys/unix"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -99,10 +100,12 @@ func applyInboundSocketOptions(network string, fd uintptr, config *SocketConfig)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if config.ReceiveOriginalDestAddress && isUDPSocket(network) {
|
|
|
|
if config.ReceiveOriginalDestAddress && isUDPSocket(network) {
|
|
|
|
|
|
|
|
if err := syscall.SetsockoptInt(int(fd), syscall.SOL_IPV6, unix.IPV6_RECVORIGDSTADDR, 1); err != nil {
|
|
|
|
if err := syscall.SetsockoptInt(int(fd), syscall.SOL_IP, syscall.IP_RECVORIGDSTADDR, 1); err != nil {
|
|
|
|
if err := syscall.SetsockoptInt(int(fd), syscall.SOL_IP, syscall.IP_RECVORIGDSTADDR, 1); err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if err := syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, unix.SO_REUSEPORT, 1); err != nil {
|
|
|
|
if err := syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, unix.SO_REUSEPORT, 1); err != nil {
|
|
|
|
return newError("failed to set SO_REUSEPORT").Base(err).AtWarning()
|
|
|
|
return newError("failed to set SO_REUSEPORT").Base(err).AtWarning()
|
|
|
|