Again ported to NetBSD

This commit is contained in:
Gerhard Rieger 2024-06-21 13:59:45 +02:00
parent b5b9ee0031
commit 2ab4b232fc
6 changed files with 43 additions and 3 deletions

View file

@ -3,6 +3,9 @@ Features:
Total inactivity timeout option -T 0 now means 0.0 seconds; up to Total inactivity timeout option -T 0 now means 0.0 seconds; up to
version 1.8.0.0 it meant no total inactivity timeout. version 1.8.0.0 it meant no total inactivity timeout.
Porting:
Changes for building and testing on NetBSD
Testing: Testing:
test.sh: lots of corrections and improvements test.sh: lots of corrections and improvements

View file

@ -305,6 +305,16 @@ if test "$ac_cv_apple_use_rfc_2292" = yes; then
fi fi
AC_MSG_RESULT($ac_cv_apple_use_rfc_2292) AC_MSG_RESULT($ac_cv_apple_use_rfc_2292)
AC_MSG_CHECKING(if including netinet/in.h suffices)
AC_TRY_COMPILE([#include <sys/types.h>
#include <netinet/in.h>],
[struct sockaddr_in6 s;],
[ AC_MSG_RESULT(yes); WITH_IP6=1],
[ AC_MSG_RESULT(no); WITH_IP6=])
if test "$WITH_IP6"; then
AC_DEFINE(WITH_IP6)
fi
fi fi
AC_MSG_CHECKING(whether to include raw IP support) AC_MSG_CHECKING(whether to include raw IP support)

17
utils.c
View file

@ -38,6 +38,23 @@ void *memdup(const void *src, size_t n) {
return dest; return dest;
} }
#if !HAVE_PROTOTYPE_LIB_strndup
char *strndup(
const char *s,
size_t n)
{
char *m;
m = malloc(n+1);
if (m == NULL) {
return m;
}
strncpy(m, s, n);
m[n] = '\0';
return m;
}
#endif /* !HAVE_PROTOTYPE_LIB_strndup */
/* search the keyword-table for a match of the leading part of name. */ /* search the keyword-table for a match of the leading part of name. */
/* returns the pointer to the matching field of the keyword or NULL if no /* returns the pointer to the matching field of the keyword or NULL if no
keyword was found. */ keyword was found. */

View file

@ -15,6 +15,9 @@ struct wordent {
extern void *memrchr(const void *s, int c, size_t n); extern void *memrchr(const void *s, int c, size_t n);
#endif #endif
extern void *memdup(const void *src, size_t n); extern void *memdup(const void *src, size_t n);
#if !HAVE_PROTOTYPE_LIB_strndup
extern char *strndup(const char *s, size_t n);
#endif
#if !HAVE_SETENV #if !HAVE_SETENV
extern int setenv(const char *name, const char *value, int overwrite); extern int setenv(const char *name, const char *value, int overwrite);
#endif /* !HAVE_SETENV */ #endif /* !HAVE_SETENV */

View file

@ -216,9 +216,11 @@ int xiogetaddrinfo(const char *node, const char *service,
if (family == PF_UNSPEC) family = PF_INET6; if (family == PF_UNSPEC) family = PF_INET6;
#endif /* WITH_IP6 */ #endif /* WITH_IP6 */
} }
#if HAVE_GETADDRINFO
#ifdef AI_ADDRCONFIG
if (family == 0) if (family == 0)
hints.ai_flags |= AI_ADDRCONFIG; hints.ai_flags |= AI_ADDRCONFIG;
#if HAVE_GETADDRINFO #endif
if (node != NULL || service != NULL) { if (node != NULL || service != NULL) {
struct addrinfo *record; struct addrinfo *record;

View file

@ -1121,7 +1121,7 @@ int
#elif HAVE_DTLSv1_client_method #elif HAVE_DTLSv1_client_method
method = sycDTLSv1_client_method(); method = sycDTLSv1_client_method();
#else #else
# error "OpenSSL does not seem to provide DTLS client methods" # warning "OpenSSL does not seem to provide DTLS client methods"
#endif #endif
*use_dtls = true; *use_dtls = true;
} }
@ -1192,12 +1192,17 @@ int
#elif HAVE_DTLSv1_server_method #elif HAVE_DTLSv1_server_method
method = sycDTLSv1_server_method(); method = sycDTLSv1_server_method();
#else #else
# error "OpenSSL does not seem to provide DTLS server methods" # warning "OpenSSL does not seem to provide DTLS server methods"
#endif #endif
*use_dtls = true; *use_dtls = true;
} }
} }
if (method == NULL) {
Error("no OpenSSL method available");
return STAT_NORETRY;
}
if (opt_egd) { if (opt_egd) {
#if !defined(OPENSSL_NO_EGD) && HAVE_RAND_egd #if !defined(OPENSSL_NO_EGD) && HAVE_RAND_egd
sycRAND_egd(opt_egd); sycRAND_egd(opt_egd);