Browse Source

Refine IPV6_RECVORIGDSTADDR

pull/1428/head
Max Lv 7 years ago
parent
commit
2ee9fc6417
1 changed files with 8 additions and 5 deletions
  1. 13
      src/udprelay.c

13
src/udprelay.c

@ -460,11 +460,14 @@ create_server_socket(const char *host, const char *port)
ERROR("[udp] setsockopt IP_TRANSPARENT"); ERROR("[udp] setsockopt IP_TRANSPARENT");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (setsockopt(server_sock, SOL_IP, IP_RECVORIGDSTADDR, &opt, sizeof(opt))) {
FATAL("[udp] setsockopt IP_RECVORIGDSTADDR");
}
if (setsockopt(server_sock, SOL_IPV6, IPV6_RECVORIGDSTADDR, &opt, sizeof(opt))) {
FATAL("[udp] setsockopt IPV6_RECVORIGDSTADDR");
if (rp->ai_family == AF_INET) {
if (setsockopt(server_sock, SOL_IP, IP_RECVORIGDSTADDR, &opt, sizeof(opt))) {
FATAL("[udp] setsockopt IP_RECVORIGDSTADDR");
}
} else if (rp->ai_family == AF_INET6) {
if (setsockopt(server_sock, SOL_IPV6, IPV6_RECVORIGDSTADDR, &opt, sizeof(opt))) {
FATAL("[udp] setsockopt IPV6_RECVORIGDSTADDR");
}
} }
#endif #endif

Loading…
Cancel
Save