From 81f5713ab71944d51703653eab7f364fba0c482e Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sun, 6 Jul 2003 17:15:25 +0000 Subject: [PATCH] - simplify configure.in - drop support for OpenSSL < 0.9.7 - add some missing definitions/includes --- configure.in | 33 +++++++-------------------------- m4/openssl.m4 | 11 +++++++++-- src/net.c | 7 ++----- src/net.h | 8 +++++++- src/protocol_auth.c | 6 +----- src/route.c | 20 +++++++++++++++++--- src/tincd.c | 14 +------------- 7 files changed, 44 insertions(+), 55 deletions(-) diff --git a/configure.in b/configure.in index 83e1faec..0e767601 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ 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) @@ -101,32 +101,13 @@ AC_TYPE_SIZE_T 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 - #include ], - [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 - #include - #include ], - [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 + #include + #include + ] +) dnl Checks for library functions. AC_FUNC_MEMCMP diff --git a/m4/openssl.m4 b/m4/openssl.m4 index 79dd3c11..1a61a8b5 100644 --- a/m4/openssl.m4 +++ b/m4/openssl.m4 @@ -29,13 +29,20 @@ AC_DEFUN(tinc_OPENSSL, [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 ] + ) 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] )] ) ]) diff --git a/src/net.c b/src/net.c index 582c90a5..52e9bf88 100644 --- 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. - $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" @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -73,10 +74,6 @@ #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; diff --git a/src/net.h b/src/net.h index ae384024..083cb235 100644 --- 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. - $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__ @@ -70,13 +70,19 @@ typedef short length_t; typedef union { struct sockaddr sa; struct sockaddr_in in; +#ifdef HAVE_STRUCT_SOCKADDR_IN6 struct sockaddr_in6 in6; +#endif } 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)) +#else +#define SALEN(s) (sizeof sockaddr_in) +#endif #endif typedef struct vpn_packet_t { diff --git a/src/protocol_auth.c b/src/protocol_auth.c index 134e0f06..962f6811 100644 --- a/src/protocol_auth.c +++ b/src/protocol_auth.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. - $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" @@ -37,10 +37,6 @@ #include #include -#ifndef HAVE_RAND_PSEUDO_BYTES -#define RAND_pseudo_bytes RAND_bytes -#endif - #include "conf.h" #include "net.h" #include "netutl.h" diff --git a/src/route.c b/src/route.c index 261462e2..3a1cbdfe 100644 --- a/src/route.c +++ b/src/route.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. - $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" @@ -60,10 +60,24 @@ #include "system.h" +/* Missing definitions */ + #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; @@ -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; - 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 */ diff --git a/src/tincd.c b/src/tincd.c index 7e28bcb2..989eb76d 100644 --- a/src/tincd.c +++ b/src/tincd.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. - $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" @@ -395,19 +395,7 @@ int main(int argc, char **argv, char **envp) 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(); -#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(); -- 2.39.5