aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-02-05 00:33:45 -0800
committerGuy Harris <guy@alum.mit.edu>2014-02-06 21:35:58 +0000
commit63479adf638710b6fd272be5b4b0df23bda2daac (patch)
tree0d7fd0d6b0de10ffc163b270e387aa814305e364
parent1dc06a2681495b3bb2c75fc871f156f06b973260 (diff)
Make some routines take a struct wtap_pkthdr * as an argument.
For some routines that take multiple arguments that come from a struct wtap_pkthdr, pass a pointer to the struct wtap_pkthdr in question, rather than the separate arguments. Do this even if we're passing expressions that were earlier assigned to the struct wtap_pkthdr fields in question. This simplifies the calling sequences and ensures that the right values are picked up by the called routine; in at least one case we were *not* passing the right values (the code to handle Simple Packet Blocks in pcap-ng files). Also, call the byte-swapping routines for pseudo-header fields only if we need to do byte-swapping. Change-Id: I3a8badfcfeb0237dfc1d1014185a67f18c0f2ebe Reviewed-on: https://code.wireshark.org/review/119 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--wiretap/atm.c44
-rw-r--r--wiretap/atm.h6
-rw-r--r--wiretap/iptrace.c3
-rw-r--r--wiretap/libpcap.c3
-rw-r--r--wiretap/netmon.c21
-rw-r--r--wiretap/netxray.c6
-rw-r--r--wiretap/pcap-common.c203
-rw-r--r--wiretap/pcap-common.h3
-rw-r--r--wiretap/pcapng.c8
-rw-r--r--wiretap/snoop.c3
10 files changed, 146 insertions, 154 deletions
diff --git a/wiretap/atm.c b/wiretap/atm.c
index b9053e3f1f..34057963a8 100644
--- a/wiretap/atm.c
+++ b/wiretap/atm.c
@@ -34,35 +34,34 @@
*/
void
-atm_guess_traffic_type(const guint8 *pd, guint32 len,
- union wtap_pseudo_header *pseudo_header)
+atm_guess_traffic_type(struct wtap_pkthdr *phdr, const guint8 *pd)
{
/*
* Start out assuming nothing other than that it's AAL5.
*/
- pseudo_header->atm.aal = AAL_5;
- pseudo_header->atm.type = TRAF_UNKNOWN;
- pseudo_header->atm.subtype = TRAF_ST_UNKNOWN;
+ phdr->pseudo_header.atm.aal = AAL_5;
+ phdr->pseudo_header.atm.type = TRAF_UNKNOWN;
+ phdr->pseudo_header.atm.subtype = TRAF_ST_UNKNOWN;
- if (pseudo_header->atm.vpi == 0) {
+ if (phdr->pseudo_header.atm.vpi == 0) {
/*
* Traffic on some PVCs with a VPI of 0 and certain
* VCIs is of particular types.
*/
- switch (pseudo_header->atm.vci) {
+ switch (phdr->pseudo_header.atm.vci) {
case 5:
/*
* Signalling AAL.
*/
- pseudo_header->atm.aal = AAL_SIGNALLING;
+ phdr->pseudo_header.atm.aal = AAL_SIGNALLING;
return;
case 16:
/*
* ILMI.
*/
- pseudo_header->atm.type = TRAF_ILMI;
+ phdr->pseudo_header.atm.type = TRAF_ILMI;
return;
}
}
@@ -73,21 +72,21 @@ atm_guess_traffic_type(const guint8 *pd, guint32 len,
* to guess.
*/
- if (len >= 3) {
+ if (phdr->caplen >= 3) {
if (pd[0] == 0xaa && pd[1] == 0xaa && pd[2] == 0x03) {
/*
* Looks like a SNAP header; assume it's LLC
* multiplexed RFC 1483 traffic.
*/
- pseudo_header->atm.type = TRAF_LLCMX;
- } else if ((pseudo_header->atm.aal5t_len &&
- pseudo_header->atm.aal5t_len < 16) || len<16) {
+ phdr->pseudo_header.atm.type = TRAF_LLCMX;
+ } else if ((phdr->pseudo_header.atm.aal5t_len && phdr->pseudo_header.atm.aal5t_len < 16) ||
+ phdr->caplen < 16) {
/*
* As this cannot be a LANE Ethernet frame (less
* than 2 bytes of LANE header + 14 bytes of
* Ethernet header) we can try it as a SSCOP frame.
*/
- pseudo_header->atm.aal = AAL_SIGNALLING;
+ phdr->pseudo_header.atm.aal = AAL_SIGNALLING;
} else if (pd[0] == 0x83 || pd[0] == 0x81) {
/*
* MTP3b headers often encapsulate
@@ -95,33 +94,32 @@ atm_guess_traffic_type(const guint8 *pd, guint32 len,
* This should cause 0x83 or 0x81
* in the first byte.
*/
- pseudo_header->atm.aal = AAL_SIGNALLING;
+ phdr->pseudo_header.atm.aal = AAL_SIGNALLING;
} else {
/*
* Assume it's LANE.
*/
- pseudo_header->atm.type = TRAF_LANE;
- atm_guess_lane_type(pd, len, pseudo_header);
+ phdr->pseudo_header.atm.type = TRAF_LANE;
+ atm_guess_lane_type(phdr, pd);
}
} else {
/*
* Not only VCI 5 is used for signaling. It might be
* one of these VCIs.
*/
- pseudo_header->atm.aal = AAL_SIGNALLING;
+ phdr->pseudo_header.atm.aal = AAL_SIGNALLING;
}
}
void
-atm_guess_lane_type(const guint8 *pd, guint32 len,
- union wtap_pseudo_header *pseudo_header)
+atm_guess_lane_type(struct wtap_pkthdr *phdr, const guint8 *pd)
{
- if (len >= 2) {
+ if (phdr->caplen >= 2) {
if (pd[0] == 0xff && pd[1] == 0x00) {
/*
* Looks like LE Control traffic.
*/
- pseudo_header->atm.subtype = TRAF_ST_LANE_LE_CTRL;
+ phdr->pseudo_header.atm.subtype = TRAF_ST_LANE_LE_CTRL;
} else {
/*
* XXX - Ethernet, or Token Ring?
@@ -131,7 +129,7 @@ atm_guess_lane_type(const guint8 *pd, guint32 len,
* still be situations where the user has to
* tell us.
*/
- pseudo_header->atm.subtype = TRAF_ST_LANE_802_3;
+ phdr->pseudo_header.atm.subtype = TRAF_ST_LANE_802_3;
}
}
}
diff --git a/wiretap/atm.h b/wiretap/atm.h
index fe7b5130a1..4db8837b87 100644
--- a/wiretap/atm.h
+++ b/wiretap/atm.h
@@ -32,11 +32,9 @@
*/
extern void
-atm_guess_traffic_type(const guint8 *pd, guint32 len,
- union wtap_pseudo_header *pseudo_header);
+atm_guess_traffic_type(struct wtap_pkthdr *phdr, const guint8 *pd);
extern void
-atm_guess_lane_type(const guint8 *pd, guint32 len,
- union wtap_pseudo_header *pseudo_header);
+atm_guess_lane_type(struct wtap_pkthdr *phdr, const guint8 *pd);
#endif /* __ATM_H__ */
diff --git a/wiretap/iptrace.c b/wiretap/iptrace.c
index ea1bef4998..c2af2caec2 100644
--- a/wiretap/iptrace.c
+++ b/wiretap/iptrace.c
@@ -487,8 +487,7 @@ iptrace_read_rec_data(FILE_T fh, Buffer *buf, struct wtap_pkthdr *phdr,
* Attempt to guess from the packet data, the VPI,
* and the VCI information about the type of traffic.
*/
- atm_guess_traffic_type(buffer_start_ptr(buf), phdr->caplen,
- &phdr->pseudo_header);
+ atm_guess_traffic_type(phdr, buffer_start_ptr(buf));
}
return TRUE;
diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c
index a323cde1b3..3c65dab0b6 100644
--- a/wiretap/libpcap.c
+++ b/wiretap/libpcap.c
@@ -696,8 +696,7 @@ libpcap_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
libpcap = (libpcap_t *)wth->priv;
pcap_read_post_process(wth->file_type_subtype, wth->file_encap,
- &phdr->pseudo_header, buffer_start_ptr(buf), packet_size,
- libpcap->byte_swapped, -1);
+ phdr, buffer_start_ptr(buf), libpcap->byte_swapped, -1);
return TRUE;
}
diff --git a/wiretap/netmon.c b/wiretap/netmon.c
index 717992a738..a15c143c5e 100644
--- a/wiretap/netmon.c
+++ b/wiretap/netmon.c
@@ -443,8 +443,8 @@ netmon_trailer_size(netmon_t *netmon)
}
static void
-netmon_set_pseudo_header_info(int pkt_encap,
- union wtap_pseudo_header *pseudo_header, Buffer *buf, int length)
+netmon_set_pseudo_header_info(int pkt_encap, struct wtap_pkthdr *phdr,
+ Buffer *buf)
{
guint8 *pd = buffer_start_ptr(buf);
@@ -453,16 +453,16 @@ netmon_set_pseudo_header_info(int pkt_encap,
case WTAP_ENCAP_ATM_PDUS:
/*
* Attempt to guess from the packet data, the VPI, and
- * the VCIinformation about the type of traffic.
+ * the VCI information about the type of traffic.
*/
- atm_guess_traffic_type(pd, length, pseudo_header);
+ atm_guess_traffic_type(phdr, pd);
break;
case WTAP_ENCAP_ETHERNET:
/*
* We assume there's no FCS in this frame.
*/
- pseudo_header->eth.fcs_len = 0;
+ phdr->pseudo_header.eth.fcs_len = 0;
break;
case WTAP_ENCAP_IEEE_802_11_NETMON:
@@ -472,8 +472,8 @@ netmon_set_pseudo_header_info(int pkt_encap,
* I'm not sure about control frames. An
* "FCS length" of -2 means "NetMon weirdness".
*/
- pseudo_header->ieee_802_11.fcs_len = -2;
- pseudo_header->ieee_802_11.decrypted = FALSE;
+ phdr->pseudo_header.ieee_802_11.fcs_len = -2;
+ phdr->pseudo_header.ieee_802_11.decrypted = FALSE;
break;
}
}
@@ -740,8 +740,8 @@ again:
return FALSE;
}
- netmon_set_pseudo_header_info(wth->phdr.pkt_encap,
- &wth->phdr.pseudo_header, wth->frame_buffer, wth->phdr.caplen);
+ netmon_set_pseudo_header_info(wth->phdr.pkt_encap, &wth->phdr,
+ wth->frame_buffer);
return TRUE;
}
@@ -787,8 +787,7 @@ netmon_seek_read(wtap *wth, gint64 seek_off,
return FALSE;
}
- netmon_set_pseudo_header_info(phdr->pkt_encap,
- &phdr->pseudo_header, buf, phdr->caplen);
+ netmon_set_pseudo_header_info(phdr->pkt_encap, phdr, buf);
return TRUE;
}
diff --git a/wiretap/netxray.c b/wiretap/netxray.c
index 774262cf3e..a416a7723e 100644
--- a/wiretap/netxray.c
+++ b/wiretap/netxray.c
@@ -1642,8 +1642,7 @@ netxray_guess_atm_type(wtap *wth, struct wtap_pkthdr *phdr, Buffer *buf)
* on the VPI/VCI and packet contents.
*/
pd = buffer_start_ptr(buf);
- atm_guess_traffic_type(pd, phdr->caplen,
- &phdr->pseudo_header);
+ atm_guess_traffic_type(phdr, pd);
} else if (phdr->pseudo_header.atm.aal == AAL_5 &&
phdr->pseudo_header.atm.type == TRAF_LANE) {
/*
@@ -1651,8 +1650,7 @@ netxray_guess_atm_type(wtap *wth, struct wtap_pkthdr *phdr, Buffer *buf)
* packet contents.
*/
pd = buffer_start_ptr(buf);
- atm_guess_lane_type(pd, phdr->caplen,
- &phdr->pseudo_header);
+ atm_guess_lane_type(phdr, pd);
}
}
}
diff --git a/wiretap/pcap-common.c b/wiretap/pcap-common.c
index 01fadec39b..f262e2be9d 100644
--- a/wiretap/pcap-common.c
+++ b/wiretap/pcap-common.c
@@ -1185,113 +1185,122 @@ struct usb_device_setup_hdr {
sizeof(*fieldp))
static void
-pcap_process_linux_usb_pseudoheader(guint packet_size, gboolean byte_swapped,
- gboolean header_len_64_bytes, guint8 *pd)
+pcap_byteswap_linux_usb_pseudoheader(struct wtap_pkthdr *phdr, guint8 *pd,
+ gboolean header_len_64_bytes)
{
- struct linux_usb_phdr *phdr;
+ guint packet_size;
+ struct linux_usb_phdr *usb_phdr;
struct linux_usb_isodesc *pisodesc;
gint32 iso_numdesc, i;
- if (byte_swapped) {
- /*
- * Greasy hack, but we never directly direference any of
- * the fields in *phdr, we just get offsets of and
- * addresses of its members, so it's safe.
- */
- phdr = (struct linux_usb_phdr *)(void *)pd;
+ /*
+ * Minimum of captured and actual length (just in case the
+ * actual length < the captured length, which Should Never
+ * Happen).
+ */
+ packet_size = phdr->caplen;
+ if (packet_size > phdr->len)
+ packet_size = phdr->len;
- if (packet_size < END_OFFSETOF(phdr, &phdr->id))
- return;
- PBSWAP64((guint8 *)&phdr->id);
- if (packet_size < END_OFFSETOF(phdr, &phdr->bus_id))
+ /*
+ * Greasy hack, but we never directly dereference any of
+ * the fields in *usb_phdr, we just get offsets of and
+ * addresses of its members and byte-swap it with a
+ * byte-at-a-time macro, so it's alignment-safe.
+ */
+ usb_phdr = (struct linux_usb_phdr *)(void *)pd;
+
+ if (packet_size < END_OFFSETOF(usb_phdr, &usb_phdr->id))
+ return;
+ PBSWAP64((guint8 *)&usb_phdr->id);
+ if (packet_size < END_OFFSETOF(usb_phdr, &usb_phdr->bus_id))
+ return;
+ PBSWAP16((guint8 *)&usb_phdr->bus_id);
+ if (packet_size < END_OFFSETOF(usb_phdr, &usb_phdr->ts_sec))
+ return;
+ PBSWAP64((guint8 *)&usb_phdr->ts_sec);
+ if (packet_size < END_OFFSETOF(usb_phdr, &usb_phdr->ts_usec))
+ return;
+ PBSWAP32((guint8 *)&usb_phdr->ts_usec);
+ if (packet_size < END_OFFSETOF(usb_phdr, &usb_phdr->status))
+ return;
+ PBSWAP32((guint8 *)&usb_phdr->status);
+ if (packet_size < END_OFFSETOF(usb_phdr, &usb_phdr->urb_len))
+ return;
+ PBSWAP32((guint8 *)&usb_phdr->urb_len);
+ if (packet_size < END_OFFSETOF(usb_phdr, &usb_phdr->data_len))
+ return;
+ PBSWAP32((guint8 *)&usb_phdr->data_len);
+
+ if (usb_phdr->transfer_type == URB_ISOCHRONOUS) {
+ if (packet_size < END_OFFSETOF(usb_phdr, &usb_phdr->s.iso.error_count))
return;
- PBSWAP16((guint8 *)&phdr->bus_id);
- if (packet_size < END_OFFSETOF(phdr, &phdr->ts_sec))
+ PBSWAP32((guint8 *)&usb_phdr->s.iso.error_count);
+
+ if (packet_size < END_OFFSETOF(usb_phdr, &usb_phdr->s.iso.numdesc))
return;
- PBSWAP64((guint8 *)&phdr->ts_sec);
- if (packet_size < END_OFFSETOF(phdr, &phdr->ts_usec))
+ PBSWAP32((guint8 *)&usb_phdr->s.iso.numdesc);
+ }
+
+ if (header_len_64_bytes) {
+ /*
+ * This is either the "version 1" header, with
+ * 16 bytes of additional fields at the end, or
+ * a "version 0" header from a memory-mapped
+ * capture, with 16 bytes of zeroed-out padding
+ * at the end. Byte swap them as if this were
+ * a "version 1" header.
+ *
+ * Yes, the first argument to END_OFFSETOF() should
+ * be usb_phdr, not usb_phdr_ext; we want the offset of
+ * the additional fields from the beginning of
+ * the packet.
+ */
+ if (packet_size < END_OFFSETOF(usb_phdr, &usb_phdr->interval))
return;
- PBSWAP32((guint8 *)&phdr->ts_usec);
- if (packet_size < END_OFFSETOF(phdr, &phdr->status))
+ PBSWAP32((guint8 *)&usb_phdr->interval);
+ if (packet_size < END_OFFSETOF(usb_phdr, &usb_phdr->start_frame))
return;
- PBSWAP32((guint8 *)&phdr->status);
- if (packet_size < END_OFFSETOF(phdr, &phdr->urb_len))
+ PBSWAP32((guint8 *)&usb_phdr->start_frame);
+ if (packet_size < END_OFFSETOF(usb_phdr, &usb_phdr->xfer_flags))
return;
- PBSWAP32((guint8 *)&phdr->urb_len);
- if (packet_size < END_OFFSETOF(phdr, &phdr->data_len))
+ PBSWAP32((guint8 *)&usb_phdr->xfer_flags);
+ if (packet_size < END_OFFSETOF(usb_phdr, &usb_phdr->ndesc))
return;
- PBSWAP32((guint8 *)&phdr->data_len);
-
- if (phdr->transfer_type == URB_ISOCHRONOUS) {
- if (packet_size < END_OFFSETOF(phdr, &phdr->s.iso.error_count))
- return;
- PBSWAP32((guint8 *)&phdr->s.iso.error_count);
-
- if (packet_size < END_OFFSETOF(phdr, &phdr->s.iso.numdesc))
- return;
- PBSWAP32((guint8 *)&phdr->s.iso.numdesc);
+ PBSWAP32((guint8 *)&usb_phdr->ndesc);
+ }
- }
+ if (usb_phdr->transfer_type == URB_ISOCHRONOUS) {
+ /* swap the values in struct linux_usb_isodesc */
+ /*
+ * See previous "Greasy hack" comment.
+ */
if (header_len_64_bytes) {
+ pisodesc = (struct linux_usb_isodesc*)(void *)(pd + 64);
+ } else {
+ pisodesc = (struct linux_usb_isodesc*)(void *)(pd + 48);
+ }
+ iso_numdesc = usb_phdr->s.iso.numdesc;
+ for (i = 0; i < iso_numdesc; i++) {
/*
- * This is either the "version 1" header, with
- * 16 bytes of additional fields at the end, or
- * a "version 0" header from a memory-mapped
- * capture, with 16 bytes of zeroed-out padding
- * at the end. Byte swap them as if this were
- * a "version 1" header.
- *
- * Yes, the first argument to END_OFFSETOF() should
- * be phdr, not phdr_ext; we want the offset of
- * the additional fields from the beginning of
- * the packet.
+ * Always check if we have enough data from the
+ * beginning of the packet (usb_phdr).
*/
- if (packet_size < END_OFFSETOF(phdr, &phdr->interval))
+ if (packet_size < END_OFFSETOF(usb_phdr, &pisodesc->iso_status))
return;
- PBSWAP32((guint8 *)&phdr->interval);
- if (packet_size < END_OFFSETOF(phdr, &phdr->start_frame))
+ PBSWAP32((guint8 *)&pisodesc->iso_status);
+ if (packet_size < END_OFFSETOF(usb_phdr, &pisodesc->iso_off))
return;
- PBSWAP32((guint8 *)&phdr->start_frame);
- if (packet_size < END_OFFSETOF(phdr, &phdr->xfer_flags))
+ PBSWAP32((guint8 *)&pisodesc->iso_off);
+ if (packet_size < END_OFFSETOF(usb_phdr, &pisodesc->iso_len))
return;
- PBSWAP32((guint8 *)&phdr->xfer_flags);
- if (packet_size < END_OFFSETOF(phdr, &phdr->ndesc))
+ PBSWAP32((guint8 *)&pisodesc->iso_len);
+ if (packet_size < END_OFFSETOF(usb_phdr, &pisodesc->_pad))
return;
- PBSWAP32((guint8 *)&phdr->ndesc);
- }
-
- if (phdr->transfer_type == URB_ISOCHRONOUS) {
- /* swap the values in struct linux_usb_isodesc */
+ PBSWAP32((guint8 *)&pisodesc->_pad);
- /*
- * See previous "Greasy hack" comment.
- */
- if (header_len_64_bytes) {
- pisodesc = (struct linux_usb_isodesc*)(void *)(pd + 64);
- } else {
- pisodesc = (struct linux_usb_isodesc*)(void *)(pd + 48);
- }
- iso_numdesc = phdr->s.iso.numdesc;
- for (i = 0; i < iso_numdesc; i++) {
- /* always check if we have enough data from the
- * beginnig of the packet (phdr)
- */
- if (packet_size < END_OFFSETOF(phdr, &pisodesc->iso_status))
- return;
- PBSWAP32((guint8 *)&pisodesc->iso_status);
- if (packet_size < END_OFFSETOF(phdr, &pisodesc->iso_off))
- return;
- PBSWAP32((guint8 *)&pisodesc->iso_off);
- if (packet_size < END_OFFSETOF(phdr, &pisodesc->iso_len))
- return;
- PBSWAP32((guint8 *)&pisodesc->iso_len);
- if (packet_size < END_OFFSETOF(phdr, &pisodesc->_pad))
- return;
- PBSWAP32((guint8 *)&pisodesc->_pad);
-
- pisodesc++;
- }
+ pisodesc++;
}
}
}
@@ -1790,8 +1799,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
void
pcap_read_post_process(int file_type, int wtap_encap,
- union wtap_pseudo_header *pseudo_header,
- guint8 *pd, guint packet_size, gboolean bytes_swapped, int fcs_len)
+ struct wtap_pkthdr *phdr, guint8 *pd, gboolean bytes_swapped, int fcs_len)
{
switch (wtap_encap) {
@@ -1803,7 +1811,7 @@ pcap_read_post_process(int file_type, int wtap_encap,
* Guess the traffic type based on the packet
* contents.
*/
- atm_guess_traffic_type(pd, packet_size, pseudo_header);
+ atm_guess_traffic_type(phdr, pd);
} else {
/*
* SunATM.
@@ -1812,24 +1820,23 @@ pcap_read_post_process(int file_type, int wtap_encap,
* type of LANE traffic it is based on the packet
* contents.
*/
- if (pseudo_header->atm.type == TRAF_LANE)
- atm_guess_lane_type(pd, packet_size,
- pseudo_header);
+ if (phdr->pseudo_header.atm.type == TRAF_LANE)
+ atm_guess_lane_type(phdr, pd);
}
break;
case WTAP_ENCAP_ETHERNET:
- pseudo_header->eth.fcs_len = fcs_len;
+ phdr->pseudo_header.eth.fcs_len = fcs_len;
break;
case WTAP_ENCAP_USB_LINUX:
- pcap_process_linux_usb_pseudoheader(packet_size,
- bytes_swapped, FALSE, pd);
+ if (bytes_swapped)
+ pcap_byteswap_linux_usb_pseudoheader(phdr, pd, FALSE);
break;
case WTAP_ENCAP_USB_LINUX_MMAPPED:
- pcap_process_linux_usb_pseudoheader(packet_size,
- bytes_swapped, TRUE, pd);
+ if (bytes_swapped)
+ pcap_byteswap_linux_usb_pseudoheader(phdr, pd, TRUE);
break;
case WTAP_ENCAP_NETANALYZER:
@@ -1838,7 +1845,7 @@ pcap_read_post_process(int file_type, int wtap_encap,
* dissector calls the "Ethernet with FCS"
* dissector, but we might as well set it.
*/
- pseudo_header->eth.fcs_len = 4;
+ phdr->pseudo_header.eth.fcs_len = 4;
break;
default:
diff --git a/wiretap/pcap-common.h b/wiretap/pcap-common.h
index 734d81856f..d0cc529cc5 100644
--- a/wiretap/pcap-common.h
+++ b/wiretap/pcap-common.h
@@ -36,8 +36,7 @@ extern int pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
struct wtap_pkthdr *phdr, int *err, gchar **err_info);
extern void pcap_read_post_process(int file_type, int wtap_encap,
- union wtap_pseudo_header *pseudo_header,
- guint8 *pd, guint packet_size, gboolean bytes_swapped, int fcs_len);
+ struct wtap_pkthdr *phdr, guint8 *pd, gboolean bytes_swapped, int fcs_len);
extern int pcap_get_phdr_size(int encap,
const union wtap_pseudo_header *pseudo_header);
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c
index 6afc024f7c..72b2c2aed3 100644
--- a/wiretap/pcapng.c
+++ b/wiretap/pcapng.c
@@ -1272,9 +1272,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, wta
g_free(option_content);
pcap_read_post_process(WTAP_FILE_TYPE_SUBTYPE_PCAPNG, int_data.wtap_encap,
- (union wtap_pseudo_header *)&wblock->packet_header->pseudo_header,
- buffer_start_ptr(wblock->frame_buffer),
- (int) (packet.cap_len - pseudo_header_len),
+ wblock->packet_header, buffer_start_ptr(wblock->frame_buffer),
pn->byte_swapped, fcslen);
return block_read;
}
@@ -1450,9 +1448,7 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *
}
pcap_read_post_process(WTAP_FILE_TYPE_SUBTYPE_PCAPNG, int_data.wtap_encap,
- (union wtap_pseudo_header *)&wblock->packet_header->pseudo_header,
- buffer_start_ptr(wblock->frame_buffer),
- (int) simple_packet.cap_len,
+ wblock->packet_header, buffer_start_ptr(wblock->frame_buffer),
pn->byte_swapped, pn->if_fcslen);
return block_read;
}
diff --git a/wiretap/snoop.c b/wiretap/snoop.c
index 985cfe9f9e..410b3b03e6 100644
--- a/wiretap/snoop.c
+++ b/wiretap/snoop.c
@@ -656,8 +656,7 @@ snoop_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
*/
if (wth->file_encap == WTAP_ENCAP_ATM_PDUS &&
phdr->pseudo_header.atm.type == TRAF_LANE) {
- atm_guess_lane_type(buffer_start_ptr(buf), packet_size,
- &phdr->pseudo_header);
+ atm_guess_lane_type(phdr, buffer_start_ptr(buf));
}
return rec_size - ((guint)sizeof hdr + packet_size);