From eaa0a2777dc29e5f701efbc037b303b52f3e08be Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Wed, 3 Jul 2013 17:41:04 +0200 Subject: pcap: invoke dev->type to pcap linktype mapper Invoke dev->type to pcap linktype mapper in order to write a correct pcap file header for various link types. Also fix two bugs in pcap file header parsing and print a warning with the magic link number in case of an unknown link type. Signed-off-by: Daniel Borkmann --- pcap_io.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pcap_io.h') diff --git a/pcap_io.h b/pcap_io.h index b61e042..310ac6c 100644 --- a/pcap_io.h +++ b/pcap_io.h @@ -663,17 +663,17 @@ static inline void pcap_validate_header(const struct pcap_filehdr *hdr) pcap_check_magic(hdr->magic); if (hdr->linktype < LINKTYPE_MAX) { - if (!pcap_supported_linktypes[hdr->linktype]) + if (pcap_supported_linktypes[hdr->linktype]) good = true; } if (linktype_swab < LINKTYPE_MAX) { - if (!pcap_supported_linktypes[linktype_swab]) + if (pcap_supported_linktypes[linktype_swab]) good = true; } if (!good) - panic("This file has an unsupported pcap header!\n"); + panic("This file has an unsupported pcap link type (%d)!\n", hdr->linktype); if (unlikely(hdr->version_major != PCAP_VERSION_MAJOR) && ___constant_swab16(hdr->version_major) != PCAP_VERSION_MAJOR) panic("This file has not a valid pcap header\n"); -- cgit v1.2.3-54-g00ecf