aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
diff options
context:
space:
mode:
authorHadriel Kaplan <hadrielk@yahoo.com>2015-07-20 10:35:06 -0400
committerAnders Broman <a.broman58@gmail.com>2015-08-06 03:32:13 +0000
commit910438b17f3f8b9ca9cfdbb87b3daf49dd7eb9a0 (patch)
treef57b1dd36c4e20cd7b9758476cb862b74cd1a320 /tshark.c
parent1420f3df6376f45157b7f363c6c07da3a9ac6f29 (diff)
Pcapng: support Name Resolution Block options
Make pcapng decode options in an NRB during read, and store the comment option, and write it back out as well. Also make it handle plugin handlers for unknown options in received NRB(s). Change-Id: I81863ef8d85cb1c8b5ba6673ba0e562efe77714f Reviewed-on: https://code.wireshark.org/review/9723 Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/tshark.c b/tshark.c
index 4b363c3b8e..20cb6694db 100644
--- a/tshark.c
+++ b/tshark.c
@@ -3134,8 +3134,9 @@ 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;
- wtapng_iface_descriptions_t *idb_inf;
+ wtapng_section_t *shb_hdr = NULL;
+ wtapng_iface_descriptions_t *idb_inf = NULL;
+ wtapng_name_res_t *nrb_hdr = NULL;
char *appname = NULL;
struct wtap_pkthdr phdr;
Buffer buf;
@@ -3164,6 +3165,9 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
/* Snapshot length of input file not known. */
snapshot_length = WTAP_MAX_PACKET_SIZE;
}
+
+ 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) {
appname = g_strdup_printf("TShark (Wireshark) %s", get_ws_vcs_version_info());
@@ -3176,7 +3180,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
snapshot_length, FALSE /* compressed */, &err);
else
pdh = wtap_dump_open_ng(save_file, out_file_type, linktype,
- snapshot_length, FALSE /* compressed */, shb_hdr, idb_inf, &err);
+ snapshot_length, FALSE /* compressed */, shb_hdr, idb_inf, nrb_hdr, &err);
g_free(idb_inf);
idb_inf = NULL;
@@ -3380,6 +3384,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
wtap_dump_close(pdh, &err);
g_free(shb_hdr);
g_free(appname);
+ wtap_free_nrb(nrb_hdr);
exit(2);
}
}
@@ -3485,6 +3490,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
wtap_dump_close(pdh, &err);
g_free(shb_hdr);
g_free(appname);
+ wtap_free_nrb(nrb_hdr);
exit(2);
}
}
@@ -3599,6 +3605,7 @@ out:
g_free(save_file_string);
g_free(shb_hdr);
g_free(appname);
+ wtap_free_nrb(nrb_hdr);
return err;
}