mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-12 13:58:58 -04:00
Use arc4random() for dns transaction ids where available. Patch taken from OpenBSD
svn:r1528
This commit is contained in:
parent
c79a45e009
commit
e2b2de79bf
@ -44,6 +44,7 @@ Changes in 2.0.3-alpha:
|
||||
o Make EV_PERSIST timeouts more accurate: schedule the next event based on the scheduled time of the previous event, not based on the current time.
|
||||
o Allow http.c to handle cases where getaddrinfo returns an IPv6 address. Patch from Ryan Phillips.
|
||||
o Fix a problem with excessive memory allocation when using multiple event priorities.
|
||||
o Default to using arc4random for DNS transaction IDs on systems that have it.
|
||||
|
||||
|
||||
Changes in 2.0.2-alpha:
|
||||
|
10
configure.in
10
configure.in
@ -176,14 +176,16 @@ AC_C_INLINE
|
||||
AC_HEADER_TIME
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_CHECK_FUNCS(gettimeofday vasprintf fcntl clock_gettime strtok_r strsep getaddrinfo getnameinfo strlcpy inet_ntop inet_pton signal sigaction strtoll inet_aton pipe eventfd sendfile mmap splice)
|
||||
AC_CHECK_FUNCS(gettimeofday vasprintf fcntl clock_gettime strtok_r strsep getaddrinfo getnameinfo strlcpy inet_ntop inet_pton signal sigaction strtoll inet_aton pipe eventfd sendfile mmap splice arc4random)
|
||||
|
||||
AC_CHECK_SIZEOF(long)
|
||||
|
||||
if test "x$ac_cv_func_clock_gettime" = "xyes"; then
|
||||
AC_DEFINE(DNS_USE_CPU_CLOCK_FOR_ID, 1, [Define if clock_gettime is available in libc])
|
||||
if test "x$ac_cv_func_arc4random" = "xyes" ; then
|
||||
AC_DEFINE(DNS_USE_ARC4RANDOM_FOR_ID, 1, [Define if we should use arc4random to generate dns transation IDs])
|
||||
elif test "x$ac_cv_func_clock_gettime" = "xyes"; then
|
||||
AC_DEFINE(DNS_USE_CPU_CLOCK_FOR_ID, 1, [Define if we should use clock_gettime to generate dns transation IDs])
|
||||
else
|
||||
AC_DEFINE(DNS_USE_GETTIMEOFDAY_FOR_ID, 1, [Define is no secure id variant is available])
|
||||
AC_DEFINE(DNS_USE_GETTIMEOFDAY_FOR_ID, 1, [Define if s no secure id variant is available])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for F_SETFD in fcntl.h)
|
||||
|
7
evdns.c
7
evdns.c
@ -45,12 +45,14 @@
|
||||
#ifndef _EVENT_DNS_USE_GETTIMEOFDAY_FOR_ID
|
||||
#ifndef _EVENT_DNS_USE_OPENSSL_FOR_ID
|
||||
#ifndef _EVENT_DNS_USE_FTIME_FOR_ID
|
||||
#ifndef _EVENT_DNS_USE_ARC4RANDOM_FOR_ID
|
||||
#error Must configure at least one id generation method.
|
||||
#error Please see the documentation.
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* #define _POSIX_C_SOURCE 200507 */
|
||||
#define _GNU_SOURCE
|
||||
@ -1204,6 +1206,11 @@ default_transaction_id_fn(void)
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _EVENT_DNS_USE_ARC4RANDOM_FOR_ID
|
||||
trans_id = arc4random() & 0xffff;
|
||||
#endif
|
||||
|
||||
return trans_id;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user