phdr->pkt_encap and phdr->pkt_tsprec need to be set for seek-read too.
authorGuy Harris <guy@alum.mit.edu>
Mon, 25 Jan 2016 20:20:08 +0000 (12:20 -0800)
committerGuy Harris <guy@alum.mit.edu>
Mon, 25 Jan 2016 20:20:58 +0000 (20:20 +0000)
We set them to the file's values in wtap_read(), but we weren't setting
them in wtap_seek_read(); set them in both places.

Change-Id: Id604b1c7d27d4cee6600249e9435c49d02f8dd61
Reviewed-on: https://code.wireshark.org/review/13531
Reviewed-by: Guy Harris <guy@alum.mit.edu>
wiretap/wtap.c

index 7cf87bf9cb5eef869409359ddb8116f44ff78d8b..3dfb42629796aacbe51fa6b53896ebbf5f496e1b 100644 (file)
@@ -1458,6 +1458,19 @@ gboolean
 wtap_seek_read(wtap *wth, gint64 seek_off,
        struct wtap_pkthdr *phdr, Buffer *buf, int *err, gchar **err_info)
 {
+       /*
+        * Set the packet encapsulation to the file's encapsulation
+        * value; if that's not WTAP_ENCAP_PER_PACKET, it's the
+        * right answer (and means that the read routine for this
+        * capture file type doesn't have to set it), and if it
+        * *is* WTAP_ENCAP_PER_PACKET, the caller needs to set it
+        * anyway.
+        *
+        * Do the same for the packet time stamp resolution.
+        */
+       phdr->pkt_encap = wth->file_encap;
+       phdr->pkt_tsprec = wth->file_tsprec;
+
        if (!wth->subtype_seek_read(wth, seek_off, phdr, buf, err, err_info))
                return FALSE;