From 025365a5b205087056e6252340a9f2f783945fb7 Mon Sep 17 00:00:00 2001 From: gerald Date: Thu, 13 Nov 2008 00:36:52 +0000 Subject: For libpcap captures with the DLT DLT_BLUETOOTH_HCI_H4, make sure we initialize the P2P direction. This keeps Valgrind from complaining. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@26765 f5534014-38df-0310-8fa8-9805f1628bb7 --- wiretap/libpcap.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c index cebf946336..0e38b521e5 100644 --- a/wiretap/libpcap.c +++ b/wiretap/libpcap.c @@ -622,7 +622,7 @@ static libpcap_try_t libpcap_try(wtap *wth, int *err) * pcaprec_ss990915_hdr is the largest header type. */ struct pcaprec_ss990915_hdr first_rec_hdr, second_rec_hdr; - + /* * Attempt to read the first record's header. @@ -948,6 +948,11 @@ static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info, wth->data_offset += sizeof (struct linux_usb_phdr); break; + case WTAP_ENCAP_BLUETOOTH_H4: + /* We don't have pseudoheader, so just pretend we received everything. */ + wth->pseudo_header.p2p.sent = FALSE; + break; + case WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR: if (packet_size < sizeof (struct libpcap_bt_phdr)) { /* @@ -1013,7 +1018,7 @@ static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info, orig_size -= size; packet_size -= size; wth->data_offset += size; - + break; case WTAP_ENCAP_I2C: @@ -1177,6 +1182,11 @@ libpcap_seek_read(wtap *wth, gint64 seek_off, return FALSE; /* Read error */ break; + case WTAP_ENCAP_BLUETOOTH_H4: + /* We don't have pseudoheader, so just pretend we received everything. */ + wth->pseudo_header.p2p.sent = FALSE; + break; + case WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR: if (!libpcap_read_bt_pseudoheader(wth->random_fh, pseudo_header, err)) @@ -1194,7 +1204,7 @@ libpcap_seek_read(wtap *wth, gint64 seek_off, err, err_info, &size)){ /* Read error */ - return FALSE; + return FALSE; } /* check the optional Multi Channel header */ @@ -1783,7 +1793,7 @@ libpcap_read_erf_exheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, } type = erf_exhdr[0]; erf_exhdr_sw = pntohll((guint64*) &(erf_exhdr[0])); - if (i < max) + if (i < max) memcpy(&pseudo_header->erf.ehdr_list[i].ehdr, &erf_exhdr_sw, sizeof(erf_exhdr_sw)); *psize += 8; i++; -- cgit v1.2.3