Add c-ares to the required library list.

Although c-ares support was techically optional, it was either on by
default or required in all of our packaging. Go ahead and require it
globally. C-ares is widely available and synchronous name resolution can
easily result in a horrific user experience.

Change-Id: Id67c797316ed6b8a0ab5052e55a43a1b9e2a2464
Reviewed-on: https://code.wireshark.org/review/35188
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Gerald Combs 2019-11-22 11:16:36 -08:00
parent 6a0b558ac1
commit 451a241e50
10 changed files with 16 additions and 96 deletions

View File

@ -1028,6 +1028,9 @@ reset_find_package(GTHREAD2)
find_package(GTHREAD2 REQUIRED) find_package(GTHREAD2 REQUIRED)
reset_find_package(GCRYPT GCRYPT_ERROR_LIBRARY) reset_find_package(GCRYPT GCRYPT_ERROR_LIBRARY)
find_package(GCRYPT "1.4.2" REQUIRED) find_package(GCRYPT "1.4.2" REQUIRED)
# C Asynchronous resolver
reset_find_package(CARES)
find_package(CARES "1.5.0" REQUIRED)
find_package(LEX REQUIRED) find_package(LEX REQUIRED)
find_package(YACC REQUIRED) find_package(YACC REQUIRED)
find_package(Perl REQUIRED) find_package(Perl REQUIRED)
@ -1119,9 +1122,6 @@ ws_find_package(GNUTLS ENABLE_GNUTLS HAVE_LIBGNUTLS "3.2.0")
# Kerberos # Kerberos
ws_find_package(KERBEROS ENABLE_KERBEROS HAVE_KERBEROS) ws_find_package(KERBEROS ENABLE_KERBEROS HAVE_KERBEROS)
# C Asynchronous resolver
ws_find_package(CARES ENABLE_CARES HAVE_C_ARES "1.5.0")
# Zlib compression # Zlib compression
ws_find_package(ZLIB ENABLE_ZLIB HAVE_ZLIB) ws_find_package(ZLIB ENABLE_ZLIB HAVE_ZLIB)

View File

@ -43,9 +43,6 @@
/* Define to 1 if you have the `bpf_image' function. */ /* Define to 1 if you have the `bpf_image' function. */
#cmakedefine HAVE_BPF_IMAGE 1 #cmakedefine HAVE_BPF_IMAGE 1
/* Define to use c-ares library */
#cmakedefine HAVE_C_ARES 1
/* Define to 1 if you have the <fcntl.h> header file. */ /* Define to 1 if you have the <fcntl.h> header file. */
#cmakedefine HAVE_FCNTL_H 1 #cmakedefine HAVE_FCNTL_H 1

View File

@ -35,6 +35,7 @@ since version 3.2.0:
* Windows executables and installers are now https://support.microsoft.com/en-us/help/4472027/2019-sha-2-code-signing-support-requirement-for-windows-and-wsus[signed using SHA-2 only]. * Windows executables and installers are now https://support.microsoft.com/en-us/help/4472027/2019-sha-2-code-signing-support-requirement-for-windows-and-wsus[signed using SHA-2 only].
* Save RTP stream to .au supports any codec with 8000 Hz rate supported by Wireshark (shown in RTP player). If save of audio is not possible (unsupported codec or rate), silence of same length is saved and warning is shown. * Save RTP stream to .au supports any codec with 8000 Hz rate supported by Wireshark (shown in RTP player). If save of audio is not possible (unsupported codec or rate), silence of same length is saved and warning is shown.
* C-ares is now a required dependency.
// === Removed Features and Support // === Removed Features and Support

View File

@ -69,13 +69,11 @@
#include <ws2tcpip.h> #include <ws2tcpip.h>
#endif #endif
#ifdef HAVE_C_ARES #ifdef _WIN32
# ifdef _WIN32 # define socklen_t unsigned int
# define socklen_t unsigned int #endif
# endif #include <ares.h>
# include <ares.h> #include <ares_version.h>
# include <ares_version.h>
#endif /* HAVE_C_ARES */
#include <glib.h> #include <glib.h>
@ -295,10 +293,8 @@ e_addr_resolve gbl_resolv_flags = {
FALSE, /* vlan_name */ FALSE, /* vlan_name */
FALSE /* ss7 point code names */ FALSE /* ss7 point code names */
}; };
#ifdef HAVE_C_ARES
static guint name_resolve_concurrency = 500; static guint name_resolve_concurrency = 500;
static gboolean resolve_synchronously = FALSE; static gboolean resolve_synchronously = FALSE;
#endif
/* /*
* Global variables (can be changed in GUI sections) * Global variables (can be changed in GUI sections)
@ -320,8 +316,6 @@ gchar *g_enterprises_path = NULL; /* global enterprises file */
gchar *g_penterprises_path = NULL; /* personal enterprises file */ gchar *g_penterprises_path = NULL; /* personal enterprises file */
/* first resolving call */ /* first resolving call */
/* c-ares */
#ifdef HAVE_C_ARES
/* /*
* Submitted asynchronous queries trigger a callback (c_ares_ghba_cb()). * Submitted asynchronous queries trigger a callback (c_ares_ghba_cb()).
* Queries are added to c_ares_queue_head. During processing, queries are * Queries are added to c_ares_queue_head. During processing, queries are
@ -608,14 +602,6 @@ c_ares_set_dns_servers(void)
} }
} }
#else
void
set_resolution_synchrony(gboolean synchronous _U_)
{
/* Nothing to set. */
}
#endif /* HAVE_C_ARES */
typedef struct { typedef struct {
guint32 mask; guint32 mask;
gsize mask_length; gsize mask_length;
@ -1033,8 +1019,6 @@ fill_dummy_ip6(hashipv6_t* volatile tp)
g_strlcpy(tp->name, tp->ip6, MAXNAMELEN); g_strlcpy(tp->name, tp->ip6, MAXNAMELEN);
} }
#ifdef HAVE_C_ARES
static void static void
c_ares_ghba_cb(void *arg, int status, int timeouts _U_, struct hostent *he) { c_ares_ghba_cb(void *arg, int status, int timeouts _U_, struct hostent *he) {
async_dns_queue_msg_t *caqm = (async_dns_queue_msg_t *)arg; async_dns_queue_msg_t *caqm = (async_dns_queue_msg_t *)arg;
@ -1061,7 +1045,6 @@ c_ares_ghba_cb(void *arg, int status, int timeouts _U_, struct hostent *he) {
} }
wmem_free(wmem_epan_scope(), caqm); wmem_free(wmem_epan_scope(), caqm);
} }
#endif /* HAVE_C_ARES */
/* --------------- */ /* --------------- */
static hashipv4_t * static hashipv4_t *
@ -1104,7 +1087,6 @@ host_lookup(const guint addr)
if (gbl_resolv_flags.use_external_net_name_resolver) { if (gbl_resolv_flags.use_external_net_name_resolver) {
tp->flags |= TRIED_RESOLVE_ADDRESS; tp->flags |= TRIED_RESOLVE_ADDRESS;
#ifdef HAVE_C_ARES
if (async_dns_initialized) { if (async_dns_initialized) {
/* c-ares is initialized, so we can use it */ /* c-ares is initialized, so we can use it */
if (resolve_synchronously || name_resolve_concurrency == 0) { if (resolve_synchronously || name_resolve_concurrency == 0) {
@ -1128,7 +1110,6 @@ host_lookup(const guint addr)
wmem_list_append(async_dns_queue_head, (gpointer) caqm); wmem_list_append(async_dns_queue_head, (gpointer) caqm);
} }
} }
#endif
} }
return tp; return tp;
@ -1181,7 +1162,6 @@ host_lookup6(const ws_in6_addr *addr)
if (gbl_resolv_flags.use_external_net_name_resolver) { if (gbl_resolv_flags.use_external_net_name_resolver) {
tp->flags |= TRIED_RESOLVE_ADDRESS; tp->flags |= TRIED_RESOLVE_ADDRESS;
#ifdef HAVE_C_ARES
if (async_dns_initialized) { if (async_dns_initialized) {
/* c-ares is initialized, so we can use it */ /* c-ares is initialized, so we can use it */
if (resolve_synchronously || name_resolve_concurrency == 0) { if (resolve_synchronously || name_resolve_concurrency == 0) {
@ -1205,7 +1185,6 @@ host_lookup6(const ws_in6_addr *addr)
wmem_list_append(async_dns_queue_head, (gpointer) caqm); wmem_list_append(async_dns_queue_head, (gpointer) caqm);
} }
} }
#endif
} }
return tp; return tp;
@ -2787,7 +2766,6 @@ addr_resolve_pref_init(module_t *nameres)
"Whether address/name pairs found in captured DNS packets should be used by Wireshark for name resolution.", "Whether address/name pairs found in captured DNS packets should be used by Wireshark for name resolution.",
&gbl_resolv_flags.dns_pkt_addr_resolution); &gbl_resolv_flags.dns_pkt_addr_resolution);
#ifdef HAVE_C_ARES
prefs_register_bool_preference(nameres, "use_external_name_resolver", prefs_register_bool_preference(nameres, "use_external_name_resolver",
"Use an external network name resolver", "Use an external network name resolver",
"Use your system's configured name resolver" "Use your system's configured name resolver"
@ -2835,12 +2813,6 @@ addr_resolve_pref_init(module_t *nameres)
" your DNS server behave badly.", " your DNS server behave badly.",
10, 10,
&name_resolve_concurrency); &name_resolve_concurrency);
#else
prefs_register_static_text_preference(nameres, "use_external_name_resolver",
"Use an external network name resolver: N/A",
"Support for using a concurrent external name resolver was not"
" compiled into this version of Wireshark");
#endif
prefs_register_bool_preference(nameres, "hosts_file_handling", prefs_register_bool_preference(nameres, "hosts_file_handling",
"Only use the profile \"hosts\" file", "Only use the profile \"hosts\" file",
@ -2866,9 +2838,7 @@ addr_resolve_pref_init(module_t *nameres)
void addr_resolve_pref_apply(void) void addr_resolve_pref_apply(void)
{ {
#ifdef HAVE_C_ARES
c_ares_set_dns_servers(); c_ares_set_dns_servers();
#endif
} }
void void
@ -2882,7 +2852,6 @@ disable_name_resolution(void) {
gbl_resolv_flags.ss7pc_name = FALSE; gbl_resolv_flags.ss7pc_name = FALSE;
} }
#ifdef HAVE_C_ARES
gboolean gboolean
host_name_lookup_process(void) { host_name_lookup_process(void) {
async_dns_queue_msg_t *caqm; async_dns_queue_msg_t *caqm;
@ -2948,25 +2917,6 @@ _host_name_lookup_cleanup(void) {
async_dns_initialized = FALSE; async_dns_initialized = FALSE;
} }
#else
gboolean
host_name_lookup_process(void) {
gboolean nro = new_resolved_objects;
new_resolved_objects = FALSE;
nro |= maxmind_db_lookup_process();
return nro;
}
static void
_host_name_lookup_cleanup(void) {
}
#endif /* HAVE_C_ARES */
const gchar * const gchar *
get_hostname(const guint addr) get_hostname(const guint addr)
{ {
@ -3100,10 +3050,8 @@ host_name_lookup_init(void)
g_assert(ipv6_hash_table == NULL); g_assert(ipv6_hash_table == NULL);
ipv6_hash_table = wmem_map_new(wmem_epan_scope(), ipv6_oat_hash, ipv6_equal); ipv6_hash_table = wmem_map_new(wmem_epan_scope(), ipv6_oat_hash, ipv6_equal);
#ifdef HAVE_C_ARES
g_assert(async_dns_queue_head == NULL); g_assert(async_dns_queue_head == NULL);
async_dns_queue_head = wmem_list_new(wmem_epan_scope()); async_dns_queue_head = wmem_list_new(wmem_epan_scope());
#endif
if (manually_resolved_ipv4_list == NULL) if (manually_resolved_ipv4_list == NULL)
manually_resolved_ipv4_list = wmem_list_new(wmem_epan_scope()); manually_resolved_ipv4_list = wmem_list_new(wmem_epan_scope());
@ -3129,7 +3077,6 @@ host_name_lookup_init(void)
report_open_failure(hostspath, errno, FALSE); report_open_failure(hostspath, errno, FALSE);
} }
g_free(hostspath); g_free(hostspath);
#ifdef HAVE_C_ARES
#ifdef CARES_HAVE_ARES_LIBRARY_INIT #ifdef CARES_HAVE_ARES_LIBRARY_INIT
if (ares_library_init(ARES_LIB_INIT_ALL) == ARES_SUCCESS) { if (ares_library_init(ARES_LIB_INIT_ALL) == ARES_SUCCESS) {
#endif #endif
@ -3140,8 +3087,6 @@ host_name_lookup_init(void)
#ifdef CARES_HAVE_ARES_LIBRARY_INIT #ifdef CARES_HAVE_ARES_LIBRARY_INIT
} }
#endif #endif
#else
#endif /* HAVE_C_ARES */
if (extra_hosts_files && !gbl_resolv_flags.load_hosts_file_from_profile_only) { if (extra_hosts_files && !gbl_resolv_flags.load_hosts_file_from_profile_only) {
for (i = 0; i < extra_hosts_files->len; i++) { for (i = 0; i < extra_hosts_files->len; i++) {
@ -3476,7 +3421,6 @@ eui64_to_display(wmem_allocator_t *allocator, const guint64 addr_eui64)
return ret; return ret;
} /* eui64_to_display */ } /* eui64_to_display */
#ifdef HAVE_C_ARES
#define GHI_TIMEOUT (250 * 1000) #define GHI_TIMEOUT (250 * 1000)
static void static void
c_ares_ghi_cb(void *arg, int status, int timeouts _U_, struct hostent *hp) { c_ares_ghi_cb(void *arg, int status, int timeouts _U_, struct hostent *hp) {
@ -3490,7 +3434,6 @@ c_ares_ghi_cb(void *arg, int status, int timeouts _U_, struct hostent *hp) {
ahp->copied = hp->h_length; ahp->copied = hp->h_length;
} }
} }
#endif /* HAVE_C_ARES */
/* Translate a string, assumed either to be a dotted-quad IPv4 address or /* Translate a string, assumed either to be a dotted-quad IPv4 address or
* a host name, to a numeric IPv4 address. Return TRUE if we succeed and * a host name, to a numeric IPv4 address. Return TRUE if we succeed and
@ -3498,12 +3441,10 @@ c_ares_ghi_cb(void *arg, int status, int timeouts _U_, struct hostent *hp) {
gboolean gboolean
get_host_ipaddr(const char *host, guint32 *addrp) get_host_ipaddr(const char *host, guint32 *addrp)
{ {
#ifdef HAVE_C_ARES
struct timeval tv = { 0, GHI_TIMEOUT }, *tvp; struct timeval tv = { 0, GHI_TIMEOUT }, *tvp;
int nfds; int nfds;
fd_set rfds, wfds; fd_set rfds, wfds;
async_hostent_t ahe; async_hostent_t ahe;
#endif
/* /*
* XXX - are there places where this is used to translate something * XXX - are there places where this is used to translate something
@ -3524,7 +3465,6 @@ get_host_ipaddr(const char *host, guint32 *addrp)
return FALSE; return FALSE;
} }
#ifdef HAVE_C_ARES
if (!async_dns_initialized || name_resolve_concurrency < 1) { if (!async_dns_initialized || name_resolve_concurrency < 1) {
return FALSE; return FALSE;
} }
@ -3550,7 +3490,6 @@ get_host_ipaddr(const char *host, guint32 *addrp)
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
#endif
} }
return TRUE; return TRUE;
@ -3564,12 +3503,10 @@ get_host_ipaddr(const char *host, guint32 *addrp)
gboolean gboolean
get_host_ipaddr6(const char *host, ws_in6_addr *addrp) get_host_ipaddr6(const char *host, ws_in6_addr *addrp)
{ {
#ifdef HAVE_C_ARES
struct timeval tv = { 0, GHI_TIMEOUT }, *tvp; struct timeval tv = { 0, GHI_TIMEOUT }, *tvp;
int nfds; int nfds;
fd_set rfds, wfds; fd_set rfds, wfds;
async_hostent_t ahe; async_hostent_t ahe;
#endif /* HAVE_C_ARES */
if (str_to_ip6(host, addrp)) if (str_to_ip6(host, addrp))
return TRUE; return TRUE;
@ -3591,7 +3528,6 @@ get_host_ipaddr6(const char *host, ws_in6_addr *addrp)
} }
/* try FQDN */ /* try FQDN */
#ifdef HAVE_C_ARES
if (!async_dns_initialized || name_resolve_concurrency < 1) { if (!async_dns_initialized || name_resolve_concurrency < 1) {
return FALSE; return FALSE;
} }
@ -3616,7 +3552,6 @@ get_host_ipaddr6(const char *host, ws_in6_addr *addrp)
if (ahe.addr_size == ahe.copied) { if (ahe.addr_size == ahe.copied) {
return TRUE; return TRUE;
} }
#endif
return FALSE; return FALSE;
} }

View File

@ -72,9 +72,7 @@
#include <smi.h> #include <smi.h>
#endif #endif
#ifdef HAVE_C_ARES
#include <ares_version.h> #include <ares_version.h>
#endif
#ifdef HAVE_NGHTTP2 #ifdef HAVE_NGHTTP2
#include <nghttp2/nghttp2ver.h> #include <nghttp2/nghttp2ver.h>
@ -745,11 +743,7 @@ epan_get_compiled_version_info(GString *str)
/* c-ares */ /* c-ares */
g_string_append(str, ", "); g_string_append(str, ", ");
#ifdef HAVE_C_ARES
g_string_append(str, "with c-ares " ARES_VERSION_STR); g_string_append(str, "with c-ares " ARES_VERSION_STR);
#else
g_string_append(str, "without c-ares");
#endif /* HAVE_C_ARES */
/* LUA */ /* LUA */
g_string_append(str, ", "); g_string_append(str, ", ");

View File

@ -12,7 +12,6 @@
%bcond_with lua %bcond_with lua
%bcond_with mmdbresolve %bcond_with mmdbresolve
%bcond_with lz4_and_snappy %bcond_with lz4_and_snappy
%bcond_with c_ares
%bcond_with spandsp %bcond_with spandsp
%bcond_with bcg729 %bcond_with bcg729
%bcond_with libxml2 %bcond_with libxml2
@ -99,7 +98,6 @@ Requires: snappy
%endif %endif
%endif %endif
%if %{with c_ares}
%if 0%{?suse_version} %if 0%{?suse_version}
# SUSE uses these package names (yes 2!): # SUSE uses these package names (yes 2!):
BuildRequires: libcares-devel BuildRequires: libcares-devel
@ -110,7 +108,6 @@ Requires: libcares2
BuildRequires: c-ares-devel BuildRequires: c-ares-devel
Requires: c-ares Requires: c-ares
%endif %endif
%endif
%if %{with lua} %if %{with lua}
%if 0%{?fedora} %if 0%{?fedora}
@ -309,11 +306,6 @@ cmake3 \
-DENABLE_LZ4=OFF \ -DENABLE_LZ4=OFF \
-DENABLE_SNAPPY=OFF \ -DENABLE_SNAPPY=OFF \
%endif %endif
%if %{with c_ares}
-DENABLE_CARES=ON \
%else
-DENABLE_CARES=OFF \
%endif
%if %{with spandsp} %if %{with spandsp}
-DENABLE_SPANDSP=ON \ -DENABLE_SPANDSP=ON \
%else %else
@ -505,6 +497,9 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
%{_libdir}/pkgconfig/wireshark.pc %{_libdir}/pkgconfig/wireshark.pc
%changelog %changelog
* Fri Nov 22 2019 Gerald Combs
- c-ares is a required package
* Thu Aug 15 2019 Gerald Combs * Thu Aug 15 2019 Gerald Combs
- Add zstd - Add zstd

View File

@ -4298,9 +4298,7 @@ sharkd_session_main(void)
return 2; return 2;
} }
#if defined(HAVE_C_ARES) || defined(HAVE_MAXMINDDB)
host_name_lookup_process(); host_name_lookup_process();
#endif
sharkd_session_process(buf, tokens, ret); sharkd_session_process(buf, tokens, ret);
} }

View File

@ -50,6 +50,7 @@ BASIC_LIST="cmake \
bison \ bison \
perl \ perl \
tiff-dev \ tiff-dev \
c-ares-dev \
qt5-qtbase-dev \ qt5-qtbase-dev \
qt5-qttools-dev \ qt5-qttools-dev \
qt5-qtmultimedia-dev \ qt5-qtmultimedia-dev \
@ -66,7 +67,6 @@ ADDITIONAL_LIST="
libxml2-dev \ libxml2-dev \
libmaxminddb-dev \ libmaxminddb-dev \
krb5-dev \ krb5-dev \
c-ares-dev \
lz4-dev \ lz4-dev \
gnutls-dev \ gnutls-dev \
snappy-dev \ snappy-dev \

View File

@ -116,8 +116,8 @@ echo "pkg-config is unavailable"
# c-ares: FreeBSD # c-ares: FreeBSD
# libcares: OpenBSD # libcares: OpenBSD
add_package ADDITIONAL_LIST c-ares || add_package BASIC_LIST c-ares ||
add_package ADDITIONAL_LIST libcares || add_package BASIC_LIST libcares ||
echo "c-ares is unavailable" echo "c-ares is unavailable"
# rubygem-asciidoctor: FreeBSD # rubygem-asciidoctor: FreeBSD

View File

@ -56,6 +56,7 @@ BASIC_LIST="libglib2.0-dev \
libqt5svg5-dev \ libqt5svg5-dev \
qtmultimedia5-dev \ qtmultimedia5-dev \
qt5-default \ qt5-default \
libc-ares-dev \
libpcap-dev \ libpcap-dev \
bison \ bison \
flex \ flex \
@ -65,7 +66,6 @@ BASIC_LIST="libglib2.0-dev \
libgcrypt-dev" libgcrypt-dev"
ADDITIONAL_LIST="libnl-3-dev \ ADDITIONAL_LIST="libnl-3-dev \
libc-ares-dev \
libkrb5-dev \ libkrb5-dev \
libsmi2-dev \ libsmi2-dev \
asciidoctor \ asciidoctor \