aboutsummaryrefslogtreecommitdiffstats
path: root/epan/addr_resolv.c
diff options
context:
space:
mode:
authorJohn Thacker <johnthacker@gmail.com>2023-11-01 06:22:52 -0400
committerAndersBroman <a.broman58@gmail.com>2023-11-01 14:57:25 +0000
commit317340016769c045b1ad3f5ee3b870457aa9bd8f (patch)
tree7bdfbf6365ec324bd8f762189e620a3839494a8c /epan/addr_resolv.c
parent7ac827fd74cf7b1eac80d54b5ce0001f15a587e3 (diff)
addr_resolv: Remove confusing "only use profile hosts" preference
Once upon a time, Wireshark could use GNU ADNS instead of c-ares for asynchronous DNS lookups. GNU ADNS didn't check the system hosts file (see 51984de040b804ca6614830acc62c641cd6d8959), so we added the system hosts file using the same mechanism as profile paths when using ADNS. This was then confusing, because "use external DNS resolver / use system DNS resolving" could be off but /etc/hosts was still used, so the "only use profile hosts" option was created to avoid using external system DNS hostsnames at all. c-ares (and, for that matter, libunbound) does read /etc/hosts, so this option doesn't do its primary purpose anymore. All it usually does now is keep any hosts file in the global profile from being used, but we don't have any other name resolution options where there's a pref not to use global profile data. Even more confusingly, if the option is true, then the -H option to tshark to give a hosts file on the command line doesn't work. add_hosts_file checks the preference and then doesn't actually read the file from the command line, which is surely never wanted. Most people don't understand what the option means, despite the tooltip, and assume that it means "only use the hosts file as a source of name resolution data", not "when using hosts files as a source of name resolution data, only use the one from the personal profile and not any from the global profile, the tshark command line, or any other source." Just mark the option as obsolete. Related to #11470
Diffstat (limited to 'epan/addr_resolv.c')
-rw-r--r--epan/addr_resolv.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c
index b3b5425a79..e5e1bf1c00 100644
--- a/epan/addr_resolv.c
+++ b/epan/addr_resolv.c
@@ -285,7 +285,6 @@ e_addr_resolve gbl_resolv_flags = {
FALSE, /* transport_name */
TRUE, /* dns_pkt_addr_resolution */
TRUE, /* use_external_net_name_resolver */
- FALSE, /* load_hosts_file_from_profile_only */
FALSE, /* vlan_name */
FALSE, /* ss7 point code names */
TRUE, /* maxmind_geoip */
@@ -2979,11 +2978,7 @@ addr_resolve_pref_init(module_t *nameres)
10,
&name_resolve_concurrency);
- prefs_register_bool_preference(nameres, "hosts_file_handling",
- "Only use the profile \"hosts\" file",
- "By default \"hosts\" files will be loaded from multiple sources."
- " Checking this box only loads the \"hosts\" in the current profile.",
- &gbl_resolv_flags.load_hosts_file_from_profile_only);
+ prefs_register_obsolete_preference(nameres, "hosts_file_handling");
prefs_register_bool_preference(nameres, "vlan_name",
"Resolve VLAN IDs",
@@ -3238,13 +3233,11 @@ host_name_lookup_init(void)
/*
* Load the global hosts file, if we have one.
*/
- if (!gbl_resolv_flags.load_hosts_file_from_profile_only) {
- hostspath = get_datafile_path(ENAME_HOSTS);
- if (!read_hosts_file(hostspath, TRUE) && errno != ENOENT) {
- report_open_failure(hostspath, errno, FALSE);
- }
- g_free(hostspath);
+ hostspath = get_datafile_path(ENAME_HOSTS);
+ if (!read_hosts_file(hostspath, TRUE) && errno != ENOENT) {
+ report_open_failure(hostspath, errno, FALSE);
}
+ g_free(hostspath);
/*
* Load the user's hosts file no matter what, if they have one.
*/
@@ -3264,7 +3257,7 @@ host_name_lookup_init(void)
}
#endif
- if (extra_hosts_files && !gbl_resolv_flags.load_hosts_file_from_profile_only) {
+ if (extra_hosts_files) {
for (i = 0; i < extra_hosts_files->len; i++) {
read_hosts_file((const char *) g_ptr_array_index(extra_hosts_files, i), TRUE);
}