tshark: fix -H option

The dump of the address info list must be differed to the end of the processing so as to know which host name was actually used in the capture

Bug: 10507
Change-Id: I44dbfae918d4ae92f9740c309804c7ff21bb4e1b
Reviewed-on: https://code.wireshark.org/review/4327
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Pascal Quantin 2014-09-27 01:21:10 +02:00 committed by Michael Mann
parent 7477a46f92
commit a3c4133847
2 changed files with 9 additions and 10 deletions

View File

@ -3180,13 +3180,6 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
pdh = NULL;
}
if (pdh && out_file_name_res) {
if (!wtap_dump_set_addrinfo_list(pdh, get_addrinfo_list())) {
cmdarg_err("The file format \"%s\" doesn't support name resolution information.",
wtap_file_type_subtype_short_string(out_file_type));
}
}
/* Do we have any tap listeners with filters? */
filtering_tap_listeners = have_filtering_tap_listeners();
@ -3480,6 +3473,12 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
}
} else {
if (save_file != NULL) {
if (pdh && out_file_name_res) {
if (!wtap_dump_set_addrinfo_list(pdh, get_addrinfo_list())) {
cmdarg_err("The file format \"%s\" doesn't support name resolution information.",
wtap_file_type_subtype_short_string(out_file_type));
}
}
/* Now close the capture file. */
if (!wtap_dump_close(pdh, &err))
show_capture_file_io_error(save_file, err, TRUE);

View File

@ -3632,9 +3632,6 @@ static gboolean pcapng_dump(wtap_dumper *wdh,
phdr->pkt_encap,
wtap_encap_string(phdr->pkt_encap));
/* Flush any hostname resolution info we may have */
pcapng_write_name_resolution_block(wdh, err);
switch (phdr->rec_type) {
case REC_TYPE_PACKET:
@ -3680,6 +3677,9 @@ static gboolean pcapng_dump_close(wtap_dumper *wdh, int *err _U_)
{
guint i, j;
/* Flush any hostname resolution info we may have */
pcapng_write_name_resolution_block(wdh, err);
for (i = 0; i < wdh->interface_data->len; i++) {
/* Get the interface description */