diff options
-rw-r--r-- | pcap/pcap.h | 5 | ||||
-rw-r--r-- | sf-pcap.c | 20 |
2 files changed, 7 insertions, 18 deletions
diff --git a/pcap/pcap.h b/pcap/pcap.h index 9ed5835d..3a819f04 100644 --- a/pcap/pcap.h +++ b/pcap/pcap.h @@ -262,11 +262,12 @@ struct pcap_file_header { * there are LINKTYPE_IPV4/DLT_IPV4 and LINKTYPE_IPV6/DLT_IPV6 * values if "these are IPv{4,6} and only IPv{4,6} packets" * types are needed.) + * + * Or we might be able to use it for other purposes. */ #define LT_LINKTYPE(x) ((x) & 0x0000FFFF) #define LT_LINKTYPE_EXT(x) ((x) & 0xFFFF0000) -#define LT_CLASS(x) (((x) & 0x3FFF0000) >> 16) -#define LT_CLASS_LINKTYPE 0x0000 +#define LT_RESERVED1(x) ((x) & 0x03FF0000) #define LT_FCS_LENGTH_PRESENT(x) ((x) & 0x04000000) #define LT_FCS_LENGTH(x) (((x) & 0xF0000000) >> 28) #define LT_FCS_DATALINK_EXT(x) ((((x) & 0xF) << 28) | 0x04000000) @@ -225,24 +225,12 @@ pcap_check_header(const uint8_t *magic, FILE *fp, u_int precision, char *errbuf, } /* - * Check the "class" field of the "linktype" field in the header. + * Check the main reserved field. */ - switch (LT_CLASS(hdr.linktype)) { - - case LT_CLASS_LINKTYPE: - /* - * The type field of "linktype" is a LINKTYPE_ value; - * that's normal, and we support it. - */ - break; - - default: - /* - * Unknown class. - */ + if (LT_RESERVED1(hdr.linktype) != 0) { snprintf(errbuf, PCAP_ERRBUF_SIZE, - "unsupported savefile linktype class type %u", - LT_CLASS(hdr.linktype)); + "savefile linktype reserved field not zero (0x%08x)", + LT_RESERVED1(hdr.linktype)); *err = 1; return NULL; } |