aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
diff options
context:
space:
mode:
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/tshark.c b/tshark.c
index 786afe8371..75489e605d 100644
--- a/tshark.c
+++ b/tshark.c
@@ -67,6 +67,8 @@
#include <wsutil/report_err.h>
#include <wsutil/ws_diag_control.h>
#include <wsutil/ws_version_info.h>
+#include <wiretap/wtap_opttypes.h>
+#include <wiretap/pcapng.h>
#include "globals.h"
#include <epan/timestamp.h>
@@ -3170,12 +3172,13 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
char *save_file_string = NULL;
gboolean filtering_tap_listeners;
guint tap_flags;
- wtapng_section_t *shb_hdr = NULL;
+ wtap_optionblock_t shb_hdr = NULL;
wtapng_iface_descriptions_t *idb_inf = NULL;
- wtapng_name_res_t *nrb_hdr = NULL;
+ wtap_optionblock_t nrb_hdr = NULL;
struct wtap_pkthdr phdr;
Buffer buf;
epan_dissect_t *edt = NULL;
+ char *shb_user_appl;
wtap_phdr_init(&phdr);
@@ -3205,9 +3208,12 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
nrb_hdr = wtap_file_get_nrb_for_new_file(cf->wth);
/* If we don't have an application name add Tshark */
- if (shb_hdr->shb_user_appl == NULL) {
- /* this is free'd by wtap_free_shb() later */
- shb_hdr->shb_user_appl = g_strdup_printf("TShark (Wireshark) %s", get_ws_vcs_version_info());
+ wtap_optionblock_get_option_string(shb_hdr, OPT_SHB_USERAPPL, &shb_user_appl);
+ if (shb_user_appl == NULL) {
+ /* this is free'd by wtap_optionblock_free() later */
+ shb_user_appl = g_strdup_printf("TShark (Wireshark) %s", get_ws_vcs_version_info());
+ wtap_optionblock_set_option_string(shb_hdr, OPT_SHB_USERAPPL, shb_user_appl);
+ g_free(shb_user_appl);
}
if (linktype != WTAP_ENCAP_PER_PACKET &&
@@ -3448,8 +3454,8 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
break;
}
wtap_dump_close(pdh, &err);
- wtap_free_shb(shb_hdr);
- wtap_free_nrb(nrb_hdr);
+ wtap_optionblock_free(shb_hdr);
+ wtap_optionblock_free(nrb_hdr);
exit(2);
}
}
@@ -3563,8 +3569,8 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
break;
}
wtap_dump_close(pdh, &err);
- wtap_free_shb(shb_hdr);
- wtap_free_nrb(nrb_hdr);
+ wtap_optionblock_free(shb_hdr);
+ wtap_optionblock_free(nrb_hdr);
exit(2);
}
}
@@ -3680,8 +3686,8 @@ out:
cf->wth = NULL;
g_free(save_file_string);
- wtap_free_shb(shb_hdr);
- wtap_free_nrb(nrb_hdr);
+ wtap_optionblock_free(shb_hdr);
+ wtap_optionblock_free(nrb_hdr);
return err;
}