- simplify configure.in
authorGuus Sliepen <guus@tinc-vpn.org>
Sun, 6 Jul 2003 17:15:25 +0000 (17:15 +0000)
committerGuus Sliepen <guus@tinc-vpn.org>
Sun, 6 Jul 2003 17:15:25 +0000 (17:15 +0000)
- drop support for OpenSSL < 0.9.7
- add some missing definitions/includes

configure.in
m4/openssl.m4
src/net.c
src/net.h
src/protocol_auth.c
src/route.c
src/tincd.c

index 83e1fae..0e76760 100644 (file)
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 
 dnl Process this file with autoconf to produce a configure script.
 
-dnl $Id: configure.in,v 1.13.2.61 2003/05/06 21:13:13 guus Exp $
+dnl $Id: configure.in,v 1.13.2.62 2003/07/06 17:15:24 guus Exp $
 
 AC_PREREQ(2.53)
 AC_INIT(src/tincd.c)
 
 AC_PREREQ(2.53)
 AC_INIT(src/tincd.c)
@@ -101,32 +101,13 @@ AC_TYPE_SIZE_T
 AC_HEADER_TIME
 AC_STRUCT_TM
 
 AC_HEADER_TIME
 AC_STRUCT_TM
 
-AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
-[
-  AC_TRY_COMPILE(
+AC_CHECK_TYPES([socklen_t, struct addrinfo, struct sockaddr_in6], , ,
   [#include <sys/types.h>
   [#include <sys/types.h>
-  #include <sys/socket.h>],
-  [socklen_t len = 42; return len;],
-  ac_cv_type_socklen_t=yes,
-  ac_cv_type_socklen_t=no)
-])
-if test $ac_cv_type_socklen_t = yes; then
-  AC_DEFINE(HAVE_SOCKLEN_T, 1, [socklen_t available])
-fi
-
-AC_CACHE_CHECK([for struct addrinfo], ac_cv_struct_addrinfo,
-[
-  AC_TRY_COMPILE(
-  [#include <sys/types.h>
-  #include <sys/socket.h>
-  #include <netdb.h>],
-  [struct addrinfo ai; ai.ai_family = AF_INET; return ai.ai_family;],
-  ac_cv_struct_addrinfo=yes,
-  ac_cv_struct_addrinfo=no)
-])
-if test $ac_cv_struct_addrinfo = yes; then
-  AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, [struct addrinfo available])
-fi
+   #include <sys/socket.h>
+   #include <netdb.h>
+   #include <netinet/in.h>
+  ]
+)
 
 dnl Checks for library functions.
 AC_FUNC_MEMCMP
 
 dnl Checks for library functions.
 AC_FUNC_MEMCMP
index 79dd3c1..1a61a8b 100644 (file)
@@ -29,13 +29,20 @@ AC_DEFUN(tinc_OPENSSL,
     [AC_MSG_ERROR([OpenSSL libraries not found.])]
   )
 
     [AC_MSG_ERROR([OpenSSL libraries not found.])]
   )
 
-  AC_CHECK_FUNCS([RAND_pseudo_bytes OPENSSL_add_all_algorithms_noconf OpenSSL_add_all_algorithms SSLeay_add_all_algorithms])
+  AC_CHECK_FUNCS([RAND_pseudo_bytes EVP_EncryptInit_ex], ,
+    [AC_MSG_ERROR([Missing OpenSSL functionality, make sure you have installed the latest version.]); break],
+  )
+
+  AC_CHECK_DECL([OpenSSL_add_all_algorithms], ,
+    [AC_MSG_ERROR([Missing OpenSSL functionality, make sure you have installed the latest version.]); break],
+    [#include <openssl/evp.h>]
+  )
 
   AC_CHECK_FUNC(dlopen,
     [],
     [AC_CHECK_LIB(dl, dlopen,
       [LIBS="$LIBS -ldl"],
 
   AC_CHECK_FUNC(dlopen,
     [],
     [AC_CHECK_LIB(dl, dlopen,
       [LIBS="$LIBS -ldl"],
-      [AC_MSG_ERROR([OpenSSL depends on libdl.])]
+      [AC_MSG_ERROR([OpenSSL depends on libdl.]); break]
     )]
   )
 ])
     )]
   )
 ])
index 582c90a..52e9bf8 100644 (file)
--- a/src/net.c
+++ b/src/net.c
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: net.c,v 1.35.4.186 2003/05/06 21:13:14 guus Exp $
+    $Id: net.c,v 1.35.4.187 2003/07/06 17:15:25 guus Exp $
 */
 
 #include "config.h"
 */
 
 #include "config.h"
@@ -31,6 +31,7 @@
 #include <signal.h>
 #include <sys/time.h>
 #include <sys/types.h>
 #include <signal.h>
 #include <sys/time.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 #include <syslog.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
 #include <syslog.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
 
 #include "system.h"
 
 
 #include "system.h"
 
-#ifndef HAVE_RAND_PSEUDO_BYTES
-#define RAND_pseudo_bytes RAND_bytes
-#endif
-
 int do_purge = 0;
 int sighup = 0;
 int sigalrm = 0;
 int do_purge = 0;
 int sighup = 0;
 int sigalrm = 0;
index ae38402..083cb23 100644 (file)
--- a/src/net.h
+++ b/src/net.h
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: net.h,v 1.9.4.58 2003/05/07 11:21:58 guus Exp $
+    $Id: net.h,v 1.9.4.59 2003/07/06 17:15:25 guus Exp $
 */
 
 #ifndef __TINC_NET_H__
 */
 
 #ifndef __TINC_NET_H__
@@ -70,13 +70,19 @@ typedef short length_t;
 typedef union {
        struct sockaddr sa;
        struct sockaddr_in in;
 typedef union {
        struct sockaddr sa;
        struct sockaddr_in in;
+#ifdef HAVE_STRUCT_SOCKADDR_IN6
        struct sockaddr_in6 in6;
        struct sockaddr_in6 in6;
+#endif
 } sockaddr_t;
 
 #ifdef SA_LEN
 #define SALEN(s) SA_LEN(&s)
 #else
 } sockaddr_t;
 
 #ifdef SA_LEN
 #define SALEN(s) SA_LEN(&s)
 #else
+#ifdef HAVE_STRUCT_SOCKADDR_IN6
 #define SALEN(s) (s.sa_family==AF_INET?sizeof(struct sockaddr_in):sizeof(struct sockaddr_in6))
 #define SALEN(s) (s.sa_family==AF_INET?sizeof(struct sockaddr_in):sizeof(struct sockaddr_in6))
+#else
+#define SALEN(s) (sizeof sockaddr_in)
+#endif
 #endif
 
 typedef struct vpn_packet_t {
 #endif
 
 typedef struct vpn_packet_t {
index 134e0f0..962f681 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: protocol_auth.c,v 1.1.4.19 2003/01/17 00:37:20 guus Exp $
+    $Id: protocol_auth.c,v 1.1.4.20 2003/07/06 17:15:25 guus Exp $
 */
 
 #include "config.h"
 */
 
 #include "config.h"
 #include <openssl/rand.h>
 #include <openssl/evp.h>
 
 #include <openssl/rand.h>
 #include <openssl/evp.h>
 
-#ifndef HAVE_RAND_PSEUDO_BYTES
-#define RAND_pseudo_bytes RAND_bytes
-#endif
-
 #include "conf.h"
 #include "net.h"
 #include "netutl.h"
 #include "conf.h"
 #include "net.h"
 #include "netutl.h"
index 261462e..3a1cbdf 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: route.c,v 1.1.2.51 2003/06/11 19:40:43 guus Exp $
+    $Id: route.c,v 1.1.2.52 2003/07/06 17:15:25 guus Exp $
 */
 
 #include "config.h"
 */
 
 #include "config.h"
 
 #include "system.h"
 
 
 #include "system.h"
 
+/* Missing definitions */
+
 #ifndef ETHER_ADDR_LEN
 #define ETHER_ADDR_LEN 6
 #endif
 
 #ifndef ETHER_ADDR_LEN
 #define ETHER_ADDR_LEN 6
 #endif
 
+#ifndef ICMP_DEST_UNREACH
+#define ICMP_DEST_UNREACH 3
+#endif
+
+#ifndef ICMP_NET_UNKNOWN
+#define ICMP_NET_UNKNOWN 6
+#endif
+
+#ifndef ICMP_NET_UNREACH
+#define ICMP_NET_UNREACH 0
+#endif
+
 int routing_mode = RMODE_ROUTER;
 int priorityinheritance = 0;
 int macexpire = 600;
 int routing_mode = RMODE_ROUTER;
 int priorityinheritance = 0;
 int macexpire = 600;
@@ -210,8 +224,8 @@ void route_ipv4_unreachable(vpn_packet_t *packet, uint8_t code)
        memcpy(&ip_dst, &hdr->ip_dst, 4);
        oldlen = packet->len - 14;
        
        memcpy(&ip_dst, &hdr->ip_dst, 4);
        oldlen = packet->len - 14;
        
-       if(oldlen >= IP_MSS - sizeof(*hdr) - sizeof(struct icmphdr))
-               oldlen = IP_MSS - sizeof(*hdr) - sizeof(struct icmphdr);
+       if(oldlen >= IP_MSS - sizeof(*hdr) - sizeof(*icmp))
+               oldlen = IP_MSS - sizeof(*hdr) - sizeof(*icmp);
        
        /* Copy first part of original contents to ICMP message */
        
        
        /* Copy first part of original contents to ICMP message */
        
index 7e28bcb..989eb76 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: tincd.c,v 1.10.4.68 2003/06/11 19:07:56 guus Exp $
+    $Id: tincd.c,v 1.10.4.69 2003/07/06 17:15:25 guus Exp $
 */
 
 #include "config.h"
 */
 
 #include "config.h"
@@ -395,19 +395,7 @@ int main(int argc, char **argv, char **envp)
 
        RAND_load_file("/dev/urandom", 1024);
 
 
        RAND_load_file("/dev/urandom", 1024);
 
-#ifdef HAVE_OPENSSL_ADD_ALL_ALGORITHMS_NOCONF
-       OPENSSL_add_all_algorithms_noconf();
-#else
-#ifdef HAVE_OPENSSL_ADD_ALL_ALGORITHMS
        OpenSSL_add_all_algorithms();
        OpenSSL_add_all_algorithms();
-#else
-#ifdef HAVE_SSLEAY_ADD_ALL_ALGORITHMS
-       SSLeay_add_all_algorithms();
-#else
-#error No add_all_algorithms function available!
-#endif
-#endif
-#endif
 
        if(generate_keys) {
                read_server_config();
 
        if(generate_keys) {
                read_server_config();