diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2018-09-02 14:43:40 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-09-03 04:08:21 +0000 |
commit | 8681e1deba5fc03146125f33722d2094afd02b7f (patch) | |
tree | 41e821c543b8be7b0e81bd8b236e0200ccdd8c94 /epan/addr_resolv.c | |
parent | 65b342f7497825c2abc4e98c7fd9f4ff6d8ed45c (diff) |
make IPv4 and IPv6 name resolution usable at all times
IPv4 and v6 name resolution are bound to a capture file. Using a lua
script, it is possible to trigger a name resolution when no capture file
is open. This crashes Wireshark as the hash tables for name resolution
are not initialized at this time.
martin@reykholt:~/src/wireshark.git/build$ echo "print(Address.ip(\"1.1.1.1\"))" > bla.lua
martin@reykholt:~/src/wireshark.git/build$ ./run/tshark -Xlua_script:bla.lua
Segmentation fault
martin@reykholt:~/src/wireshark.git/build$ echo "print(Address.ipv6(\"::1\"))" > bla6.lua
martin@reykholt:~/src/wireshark.git/build$ ./run/tshark -Xlua_script:bla6.lua
Segmentation fault
Make sure that the hash tables are available as long as the epan library
is initialized. Add a new function host_name_lookup_reset(), call this
function every time we set up dissection for a new capture file. This
way, we keep the name resolution results separate per capture file.
Reorder the steps in init_dissection(). Host name lookup is now
available at all times, there's no need to be in file scope when it's
initialized.
Change-Id: I9599100d5f378b6a0f73dc630e4c8af3b3ffb2cc
Reviewed-on: https://code.wireshark.org/review/29398
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/addr_resolv.c')
-rw-r--r-- | epan/addr_resolv.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c index 9049764334..f0507eb328 100644 --- a/epan/addr_resolv.c +++ b/epan/addr_resolv.c @@ -2890,7 +2890,7 @@ add_manually_resolved(void) } } -void +static void host_name_lookup_init(void) { char *hostspath; @@ -2960,7 +2960,7 @@ host_name_lookup_init(void) ss7pc_name_lookup_init(); } -void +static void host_name_lookup_cleanup(void) { guint32 i, j; @@ -2991,6 +2991,13 @@ host_name_lookup_cleanup(void) new_resolved_objects = FALSE; } + +void host_name_lookup_reset(void) +{ + host_name_lookup_cleanup(); + host_name_lookup_init(); +} + void manually_resolve_cleanup(void) { @@ -3468,8 +3475,7 @@ addr_resolv_init(void) initialize_ipxnets(); initialize_vlans(); initialize_enterprises(); - /* host name initialization is done on a per-capture-file basis */ - /*host_name_lookup_init();*/ + host_name_lookup_init(); } /* Clean up all the address resolution subsystems in this file */ @@ -3481,8 +3487,7 @@ addr_resolv_cleanup(void) ethers_cleanup(); ipx_name_lookup_cleanup(); enterprises_cleanup(); - /* host name initialization is done on a per-capture-file basis */ - /*host_name_lookup_cleanup();*/ + host_name_lookup_cleanup(); } gboolean |