Merge pull request #2300 from lucifer9/fixipv4udp

fix udp not work in ipv4 using common config
pull/2313/head
Kslr 5 years ago committed by GitHub
commit 9789a946f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -100,10 +100,10 @@ func applyInboundSocketOptions(network string, fd uintptr, config *SocketConfig)
}
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 {
return err
}
err1 := syscall.SetsockoptInt(int(fd), syscall.SOL_IPV6, unix.IPV6_RECVORIGDSTADDR, 1)
err2 := syscall.SetsockoptInt(int(fd), syscall.SOL_IP, syscall.IP_RECVORIGDSTADDR, 1)
if err1 != nil && err2 != nil {
return err1
}
}

Loading…
Cancel
Save