[tor-commits] [torsocks/osx] Compile and run tests on FreeBSD

hoganrobert at torproject.org hoganrobert at torproject.org
Sun Oct 23 18:27:17 UTC 2011


commit 9de888be00f23ba1cfe1b172de61a59da6ae0ecd
Author: Robert Hogan <robert at roberthogan.net>
Date:   Sun Feb 20 15:36:50 2011 +0000

    Compile and run tests on FreeBSD
---
 configure.in         |    3 +++
 test/test_torsocks.c |    4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/configure.in b/configure.in
index f238caa..3366420 100644
--- a/configure.in
+++ b/configure.in
@@ -572,6 +572,9 @@ case $host in
   AC_SEARCH_LIBS(pthread_create, [pthread])
   AC_SEARCH_LIBS(pthread_detach, [pthread])
     ;;
+*-*-freebsd*)
+  AC_DEFINE(FREEBSD, 1, "Define to handle FreeBSD")
+    ;;
 esac
 
 AC_SUBST(SHLIB_EXT)
diff --git a/test/test_torsocks.c b/test/test_torsocks.c
index 902a216..6e8933b 100644
--- a/test/test_torsocks.c
+++ b/test/test_torsocks.c
@@ -80,7 +80,7 @@ static int icmp_test()
     char datagram[400];
     struct sockaddr_in dest;
     struct ip *iphdr=(struct ip *) datagram;
-#ifdef OPENBSD
+#if defined(OPENBSD) || defined(FREEBSD)
     struct icmp *icmphdr=(struct icmp *)(iphdr +1);
 #else
     struct icmphdr *icmphdr=(struct icmphdr *)(iphdr +1);
@@ -112,7 +112,7 @@ static int icmp_test()
     iphdr->ip_dst.s_addr=dest.sin_addr.s_addr;
     iphdr->ip_sum=csum((unsigned short *)datagram,iphdr->ip_len >> 1);
 
-#ifdef OPENBSD
+#if defined(OPENBSD) || defined(FREEBSD)
     icmphdr->icmp_type=130;
     icmphdr->icmp_code=0;
     icmphdr->icmp_cksum=htons(0xc3b0);





More information about the tor-commits mailing list