Description: Fix network order 16bit value
Get the packet's ethertype in a way that works on any
kind of endian machine
.
Author: Ben Hildred <42656e@gmail.com>
Origin: vendor
Forwarded: BTS #873635
Last-Update: 2017-08-29
--- a/dhcpdump.c
+++ b/dhcpdump.c
@@ -132,8 +132,8 @@ void pcap_callback(u_char *user, const s
offset += ETHER_HDR_LEN;
// Check for IPv4 packets
- if (eh->ether_type != 8) {
- printf("Ignored non IPv4 packet: %d\n", eh->ether_type);
+ if (eh->ether_type != htons(0x800)) {
+ printf("Ignored non IPv4 packet: %x\n", ntohs(eh->ether_type));
return;
}