[or-cvs] r12679: Fix bug reported by Steve Murphy on or-talk: detect the s6_a (in tor/trunk: . src/common)
nickm at seul.org
nickm at seul.org
Wed Dec 5 16:30:53 UTC 2007
Author: nickm
Date: 2007-12-05 11:30:52 -0500 (Wed, 05 Dec 2007)
New Revision: 12679
Modified:
tor/trunk/
tor/trunk/ChangeLog
tor/trunk/configure.in
tor/trunk/src/common/compat.h
Log:
r15161 at tombo: nickm | 2007-12-05 11:30:37 -0500
Fix bug reported by Steve Murphy on or-talk: detect the s6_addr32 and s6_addr16 fields via autoconf.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r15161] on d9e39d38-0f13-419c-a857-e10a0ce2aa0c
Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog 2007-12-05 16:11:33 UTC (rev 12678)
+++ tor/trunk/ChangeLog 2007-12-05 16:30:52 UTC (rev 12679)
@@ -33,6 +33,8 @@
- Reject uploaded descriptors and extrainfo documents if they're
huge. Otherwise we'll cache them all over the network and it'll
clog everything up. Reported by Aljosha Judmayer.
+ - Check for presence of s6_addr16 and s6_addr32 fields in in6_addr
+ via autoconf. Should fix compile on solaris.
o Minor features:
- On USR1, when dmalloc is in use, log the top 10 memory
Modified: tor/trunk/configure.in
===================================================================
--- tor/trunk/configure.in 2007-12-05 16:11:33 UTC (rev 12678)
+++ tor/trunk/configure.in 2007-12-05 16:30:52 UTC (rev 12679)
@@ -361,6 +361,31 @@
#endif
#endif
])
+AC_CHECK_MEMBERS([struct in6_addr.s6_addr32, struct in6_addr.s6_addr16], , ,
+[#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_NETINET_IN6_H
+#include <netinet/in6.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef MS_WINDOWS
+#define WIN32_WINNT 0x400
+#define _WIN32_WINNT 0x400
+#define WIN32_LEAN_AND_MEAN
+#if defined(_MSC_VER) && (_MSC_VER < 1300)
+#include <winsock.h>
+#else
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#endif
+#endif
+])
AC_CHECK_TYPES([rlim_t], , ,
[#ifdef HAVE_SYS_TYPES_H
Modified: tor/trunk/src/common/compat.h
===================================================================
--- tor/trunk/src/common/compat.h 2007-12-05 16:11:33 UTC (rev 12678)
+++ tor/trunk/src/common/compat.h 2007-12-05 16:30:52 UTC (rev 12679)
@@ -302,15 +302,17 @@
typedef uint16_t sa_family_t;
#endif
-#ifndef _MSC_VER
-/* Apparently, MSVC doesn't define s6_addr16 or s6_addr32. How dumb. */
-/* XXXX020 detect with autoconf. */
-#define S6_ADDR16(x) ((uint16_t*)(x).s6_addr16)
+/* Apparently, MS and Solaris don't define s6_addr16 or s6_addr32. */
+#ifdef HAVE_STRUCT_IN6_ADDR_S6_ADDR32
#define S6_ADDR32(x) ((uint32_t*)(x).s6_addr32)
#else
-#define S6_ADDR16(x) ((uint16_t*)((char*)&(x).s6_addr))
#define S6_ADDR32(x) ((uint32_t*)((char*)&(x).s6_addr))
#endif
+#ifdef HAVE_STRUCT_IN6_ADDR_S6_ADDR16
+#define S6_ADDR16(x) ((uint16_t*)(x).s6_addr16)
+#else
+#define S6_ADDR16(x) ((uint16_t*)((char*)&(x).s6_addr))
+#endif
/* XXXX020 detect sockaddr_in6 correctly on ms_windows; this is also a hack. */
#if !defined(HAVE_STRUCT_SOCKADDR_IN6) && !defined(MS_WINDOWS)
More information about the tor-commits
mailing list