diff options
author | Michael Mann <mmann78@netscape.net> | 2016-06-02 20:03:06 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-06-08 03:39:49 +0000 |
commit | 73286c417eebe975edb24a024eb0230bbca29acc (patch) | |
tree | 5c07da66efff28ffc6d7b5dc7feb64a431bf99de /wiretap | |
parent | f82c661790f9e0b78268f96d50c8b1a42a559a0a (diff) |
Support reading in and storing multiple Section Header and Name Resolution blocks.
The data is not applied anywhere, just stored. The first Section Header block
is still the only one that is used to read a pcapng file.
Change-Id: If9546401101d2fe79b2325bacbd597b92127e86e
Reviewed-on: https://code.wireshark.org/review/15705
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/pcapng.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index a91b35c8c8..761c535549 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -223,7 +223,7 @@ typedef struct interface_info_s { } interface_info_t; typedef struct { - gboolean shb_read; /**< Set when first SHB read, second read will fail */ + gboolean shb_read; /**< Set when first SHB read */ gboolean byte_swapped; guint16 version_major; guint16 version_minor; @@ -559,13 +559,6 @@ pcapng_read_section_header_block(FILE_T fh, pcapng_block_header_t *bh, return PCAPNG_BLOCK_ERROR; } - /* We currently only suport one SHB */ - if (pn->shb_read == TRUE) { - *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup("pcapng_read_section_header_block: multiple section header blocks not supported"); - return PCAPNG_BLOCK_ERROR; - } - /* we currently only understand SHB V1.0 */ if (version_major != 1 || version_minor > 0) { *err = WTAP_ERR_UNSUPPORTED; @@ -2580,12 +2573,9 @@ pcapng_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) switch (wblock.type) { case(BLOCK_TYPE_SHB): - /* We don't currently support multi-section files. */ - wth->phdr.pkt_encap = WTAP_ENCAP_UNKNOWN; - wth->phdr.pkt_tsprec = WTAP_TSPREC_UNKNOWN; - *err = WTAP_ERR_UNSUPPORTED; - *err_info = g_strdup("pcapng: multi-section files not currently supported"); - return FALSE; + pcapng_debug("pcapng_read: another section header block"); + g_array_append_val(wth->shb_hdrs, wblock.block); + break; case(BLOCK_TYPE_PB): case(BLOCK_TYPE_SPB): @@ -2604,6 +2594,10 @@ pcapng_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset) case(BLOCK_TYPE_NRB): /* More name resolution entries */ pcapng_debug("pcapng_read: block type BLOCK_TYPE_NRB"); + if (wth->nrb_hdrs == NULL) { + wth->nrb_hdrs = g_array_new(FALSE, FALSE, sizeof(wtap_optionblock_t)); + } + g_array_append_val(wth->nrb_hdrs, wblock.block); break; case(BLOCK_TYPE_ISB): |