diff options
author | H. Peter Anvin <hpa@zytor.com> | 2012-03-01 22:44:32 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2012-03-01 22:44:32 -0800 |
commit | 128e6a3905fe12c546ff1eb7cb7d71334407872d (patch) | |
tree | 2fa8fdab79ec64c4c5d2e53c16a5a61c647d64c2 | |
parent | b9708e22014e03c9fa35ff7ced20e46194c39dc6 (diff) | |
download | tftp-hpa-128e6a3905fe12c546ff1eb7cb7d71334407872d.tar.gz |
Support IPv6 on MacOS X systems
Add feature test macros for MacOS X, and don't require
IPV6_RECVPKTINFO to exist.
Reported-by: YJZ <vollkommen@gmx.net>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | config.h | 7 | ||||
-rw-r--r-- | tftpd/recvfrom.c | 13 |
2 files changed, 15 insertions, 5 deletions
@@ -17,6 +17,13 @@ #ifndef CONFIG_H #define CONFIG_H 1 +/* Feature enables for specific environments */ +#ifdef __APPLE__ +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1070 +#define __APPLE_USE_RFC_3542 1 +#endif +#endif + /* Must be included before we include any system headers! */ #include "aconfig.h" /* autogenerated configuration header */ diff --git a/tftpd/recvfrom.c b/tftpd/recvfrom.c index 24abce3..d050b80 100644 --- a/tftpd/recvfrom.c +++ b/tftpd/recvfrom.c @@ -222,12 +222,15 @@ myrecvfrom(int s, void *buf, int len, unsigned int flags, #ifdef HAVE_STRUCT_IN6_PKTINFO if (cmptr->cmsg_level == IPPROTO_IPV6 && - (cmptr->cmsg_type == IPV6_RECVPKTINFO || + ( +#ifdef IPV6_RECVPKTINFO + cmptr->cmsg_type == IPV6_RECVPKTINFO || +#endif cmptr->cmsg_type == IPV6_PKTINFO)) { - memcpy(&pktinfo6, CMSG_DATA(cmptr), - sizeof(struct in6_pktinfo)); - memcpy(&myaddr->s6.sin6_addr, &pktinfo6.ipi6_addr, - sizeof(struct in6_addr)); + memcpy(&pktinfo6, CMSG_DATA(cmptr), + sizeof(struct in6_pktinfo)); + memcpy(&myaddr->s6.sin6_addr, &pktinfo6.ipi6_addr, + sizeof(struct in6_addr)); } #endif } |