*data_offset = wth->data_offset;
phdr_len = pcap_process_pseudo_header(wth, wth->fh, packet_size,
- &wth->phdr, &wth->pseudo_header, err, err_info);
+ TRUE, &wth->phdr, &wth->pseudo_header, err, err_info);
if (phdr_len < 0)
return FALSE; /* error */
return FALSE;
phdr_len = pcap_process_pseudo_header(wth, wth->random_fh, length,
- NULL, pseudo_header, err, err_info);
+ FALSE, NULL, pseudo_header, err, err_info);
if (phdr_len < 0)
return FALSE; /* error */
int
pcap_process_pseudo_header(wtap *wth, FILE_T fh, guint packet_size,
- struct wtap_pkthdr *phdr, union wtap_pseudo_header *pseudo_header,
- int *err, gchar **err_info)
+ gboolean check_packet_size, struct wtap_pkthdr *phdr,
+ union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info)
{
int phdr_len = 0;
guint size;
/*
* Nokia IPSO ATM.
*/
- if (packet_size < NOKIAATM_LEN) {
+ if (check_packet_size && packet_size < NOKIAATM_LEN) {
/*
* Uh-oh, the packet isn't big enough to even
* have a pseudo-header.
/*
* SunATM.
*/
- if (packet_size < SUNATM_LEN) {
+ if (check_packet_size && packet_size < SUNATM_LEN) {
/*
* Uh-oh, the packet isn't big enough to even
* have a pseudo-header.
break;
case WTAP_ENCAP_IRDA:
- if (packet_size < IRDA_SLL_LEN) {
+ if (check_packet_size && packet_size < IRDA_SLL_LEN) {
/*
* Uh-oh, the packet isn't big enough to even
* have a pseudo-header.
break;
case WTAP_ENCAP_MTP2_WITH_PHDR:
- if (packet_size < MTP2_HDR_LEN) {
+ if (check_packet_size && packet_size < MTP2_HDR_LEN) {
/*
* Uh-oh, the packet isn't big enough to even
* have a pseudo-header.
break;
case WTAP_ENCAP_LINUX_LAPD:
- if (packet_size < LAPD_SLL_LEN) {
+ if (check_packet_size && packet_size < LAPD_SLL_LEN) {
/*
* Uh-oh, the packet isn't big enough to even
* have a pseudo-header.
break;
case WTAP_ENCAP_SITA:
- if (packet_size < SITA_HDR_LEN) {
+ if (check_packet_size && packet_size < SITA_HDR_LEN) {
/*
* Uh-oh, the packet isn't big enough to even
* have a pseudo-header.
case WTAP_ENCAP_USB_LINUX:
case WTAP_ENCAP_USB_LINUX_MMAPPED:
- if (packet_size < sizeof (struct linux_usb_phdr)) {
+ if (check_packet_size &&
+ packet_size < sizeof (struct linux_usb_phdr)) {
/*
* Uh-oh, the packet isn't big enough to even
* have a pseudo-header.
break;
case WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR:
- if (packet_size < sizeof (struct libpcap_bt_phdr)) {
+ if (check_packet_size &&
+ packet_size < sizeof (struct libpcap_bt_phdr)) {
/*
* Uh-oh, the packet isn't big enough to even
* have a pseudo-header.
break;
case WTAP_ENCAP_ERF:
- if (packet_size < sizeof(struct erf_phdr) ) {
+ if (check_packet_size &&
+ packet_size < sizeof(struct erf_phdr) ) {
/*
* Uh-oh, the packet isn't big enough to even
* have a pseudo-header.
break;
case WTAP_ENCAP_I2C:
- if (packet_size < sizeof (struct i2c_file_hdr)) {
+ if (check_packet_size &&
+ packet_size < sizeof (struct i2c_file_hdr)) {
/*
* Uh-oh, the packet isn't big enough to even
* have a pseudo-header.
extern int wtap_wtap_encap_to_pcap_encap(int encap);
extern int pcap_process_pseudo_header(wtap *wth, FILE_T fh, guint packet_size,
- struct wtap_pkthdr *phdr, union wtap_pseudo_header *pseudo_header,
- int *err, gchar **err_info);
+ gboolean check_packet_size, struct wtap_pkthdr *phdr,
+ union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info);
extern int pcap_get_phdr_size(int encap,
const union wtap_pseudo_header *pseudo_header);