Browse Source

Fix IPV6_RECVORIGDSTADDR. #1368

pull/1386/head
Max Lv 7 years ago
parent
commit
e4884b5f21
1 changed files with 13 additions and 1 deletions
  1. 14
      src/udprelay.c

14
src/udprelay.c

@ -140,8 +140,20 @@ set_nosigpipe(int socket_fd)
#endif
#ifndef IP_RECVORIGDSTADDR
#ifdef IP_ORIGDSTADDR
#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
#else
#define IP_RECVORIGDSTADDR 20
#endif
#endif
#ifndef IPV6_RECVORIGDSTADDR
#ifdef IPV6_ORIGDSTADDR
#define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR
#else
#define IPV6_RECVORIGDSTADDR 74
#endif
#endif
static int
get_dstaddr(struct msghdr *msg, struct sockaddr_storage *dstaddr)
@ -153,7 +165,7 @@ get_dstaddr(struct msghdr *msg, struct sockaddr_storage *dstaddr)
memcpy(dstaddr, CMSG_DATA(cmsg), sizeof(struct sockaddr_in));
dstaddr->ss_family = AF_INET;
return 0;
} else if (cmsg->cmsg_level == SOL_IPV6 && cmsg->cmsg_type == IP_RECVORIGDSTADDR) {
} else if (cmsg->cmsg_level == SOL_IPV6 && cmsg->cmsg_type == IPV6_RECVORIGDSTADDR) {
memcpy(dstaddr, CMSG_DATA(cmsg), sizeof(struct sockaddr_in6));
dstaddr->ss_family = AF_INET6;
return 0;

Loading…
Cancel
Save