aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/libpcap.c
diff options
context:
space:
mode:
Diffstat (limited to 'wiretap/libpcap.c')
-rw-r--r--wiretap/libpcap.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c
index fe9c111261..fb920d4e08 100644
--- a/wiretap/libpcap.c
+++ b/wiretap/libpcap.c
@@ -669,6 +669,7 @@ libpcap_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
orig_size -= phdr_len;
packet_size -= phdr_len;
+ phdr->rec_type = REC_TYPE_PACKET;
phdr->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN;
/* Update the timestamp, if not already done */
@@ -932,6 +933,12 @@ static gboolean libpcap_dump(wtap_dumper *wdh,
phdrsize = pcap_get_phdr_size(wdh->encap, pseudo_header);
+ /* We can only write packet records. */
+ if (phdr->rec_type != REC_TYPE_PACKET) {
+ *err = WTAP_ERR_REC_TYPE_UNSUPPORTED;
+ return FALSE;
+ }
+
/* Don't write anything we're not willing to read. */
if (phdr->caplen + phdrsize > WTAP_MAX_PACKET_SIZE) {
*err = WTAP_ERR_PACKET_TOO_LARGE;