pcap_io: Only check byteswapped linktype if pcap magic is swapped
commit632e1a699e5d1d3edb822b8f55c0b55b9c7e161e
authorTobias Klauser <tklauser@distanz.ch>
Tue, 11 Mar 2014 14:12:26 +0000 (11 15:12 +0100)
committerTobias Klauser <tklauser@distanz.ch>
Tue, 11 Mar 2014 14:12:26 +0000 (11 15:12 +0100)
tree36dc1d9856fee27050eec85135d7568f51b41893
parente1af615aca2fa6e5927645eaa944db6fa89f61a4
pcap_io: Only check byteswapped linktype if pcap magic is swapped

In pcap_validate_header() the linktype and the byte-swapped linktype are
currently checked against the supported linktypes. Since the swapped
linktype is always larger than LINKTYPE_MAX, only one of the two tests
was actually done. Make this intention a bit more clear by explicitly
checking only for either the swapped or non-swapped linktype, depending
on whether the pcap magic is swapped.

Also make the error messages a bit more verbose regarding the
major/minor version.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
pcap_io.h