trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1236524 - in /trafficserver/traffic/trunk: build/network.m4 configure.ac lib/ts/ink_config.h.in lib/ts/ink_inet.h
Date Fri, 27 Jan 2012 04:33:18 GMT
Author: amc
Date: Fri Jan 27 04:33:18 2012
New Revision: 1236524

URL: http://svn.apache.org/viewvc?rev=1236524&view=rev
Log:
TS-1077 Fixes for FreeBSD and Solaris.

Modified:
    trafficserver/traffic/trunk/build/network.m4
    trafficserver/traffic/trunk/configure.ac
    trafficserver/traffic/trunk/lib/ts/ink_config.h.in
    trafficserver/traffic/trunk/lib/ts/ink_inet.h

Modified: trafficserver/traffic/trunk/build/network.m4
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/build/network.m4?rev=1236524&r1=1236523&r2=1236524&view=diff
==============================================================================
--- trafficserver/traffic/trunk/build/network.m4 (original)
+++ trafficserver/traffic/trunk/build/network.m4 Fri Jan 27 04:33:18 2012
@@ -111,4 +111,22 @@ esac
 AC_MSG_RESULT([$default_loopback_iface])
 AC_SUBST([default_loopback_iface])
 ])
+
 dnl
+dnl Check on IN6_IS_ADDR_UNSPECIFIED. We can't just check if it is defined
+dnl because some releases of FreeBSD and Solaris define it incorrectly.
+dnl
+AC_DEFUN([TS_CHECK_MACRO_IN6_IS_ADDR_UNSPECIFIED], [
+AC_CACHE_CHECK([IN6_IS_ADDR_UNSPECIFIED macro works], ac_cv_macro_in6_is_addr_unspecified,
+TS_TRY_COMPILE_NO_WARNING([
+#include <netinet/in.h>
+],[
+  (void) IN6_IS_ADDR_UNSPECIFIED(0);
+], ac_cv_macro_in6_is_addr_unspecified=yes, ac_cv_macro_in6_is_addr_unspecified=no))
+
+has_in6_is_addr_unspecified=1
+if test "x$ac_cv_macro_in6_is_addr_unspecified" = "xno"; then
+  has_in6_is_addr_unspecified=0
+fi
+AC_SUBST(has_in6_is_addr_unspecified)
+])
\ No newline at end of file

Modified: trafficserver/traffic/trunk/configure.ac
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/configure.ac?rev=1236524&r1=1236523&r2=1236524&view=diff
==============================================================================
--- trafficserver/traffic/trunk/configure.ac (original)
+++ trafficserver/traffic/trunk/configure.ac Fri Jan 27 04:33:18 2012
@@ -1264,6 +1264,7 @@ AC_SUBST(ip_transparent)
 
 TS_CHECK_LOOPBACK_IFACE
 TS_CHECK_GETHOSTBYNAME_R_STYLE
+TS_CHECK_MACRO_IN6_IS_ADDR_UNSPECIFIED
 
 #
 # use modular IOCORE

Modified: trafficserver/traffic/trunk/lib/ts/ink_config.h.in
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_config.h.in?rev=1236524&r1=1236523&r2=1236524&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_config.h.in (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_config.h.in Fri Jan 27 04:33:18 2012
@@ -98,6 +98,7 @@
 #define TS_HAS_SRAND48_R               @has_srand48_r@
 #define TS_HAS_STRLCPY                 @has_strlcpy@
 #define TS_HAS_STRLCAT                 @has_strlcat@
+#define TS_HAS_IN6_IS_ADDR_UNSPECIFIED @has_in6_is_addr_unspecified@
 
 #define TS_HAS_BACKTRACE               @has_backtrace@
 #define TS_HAS_PROFILER                @has_profiler@

Modified: trafficserver/traffic/trunk/lib/ts/ink_inet.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_inet.h?rev=1236524&r1=1236523&r2=1236524&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_inet.h (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_inet.h Fri Jan 27 04:33:18 2012
@@ -35,6 +35,16 @@
 #define INK_GETHOSTBYNAME_R_DATA_SIZE 1024
 #define INK_GETHOSTBYADDR_R_DATA_SIZE 1024
 
+#if ! TS_HAS_IN6_IS_ADDR_UNSPECIFIED
+#if defined(IN6_IS_ADDR_UNSPECIFIED)
+#undef IN6_IS_ADDR_UNSPECIFIED
+#endif
+static inline bool IN6_IS_ADDR_UNSPECIFIED(in6_addr const* addr) {
+  uint32_t const* w = reinterpret_cast<uint32_t const*>(addr);
+  return 0 == w[0] && 0 == w[1] && 0 == w[2] && 0 == w[3];
+}
+#endif
+
 class InkInetAddr; // forward declare.
 
 /** A union to hold the standard IP address structures.
@@ -555,8 +565,8 @@ inline bool ink_inet_is_nonroutable(ts_i
 /// Check for being "any" address.
 /// @return @c true if @a ip is the any / unspecified address.
 inline bool ink_inet_is_any(sockaddr const* ip) {
-  return (ink_inet_is_ip4(ip) && INADDR_ANY == ink_inet_ip4_cast(ip)) ||
-    (ink_inet_is_ip6(ip) && IN6_IS_ADDR_UNSPECIFIED(ink_inet_ip6_cast(ip)))
+  return (ink_inet_is_ip4(ip) && INADDR_ANY == ink_inet_ip4_addr_cast(ip)) ||
+    (ink_inet_is_ip6(ip) && IN6_IS_ADDR_UNSPECIFIED(&ink_inet_ip6_addr_cast(ip)))
     ;
 }
   



Mime
View raw message