It also adds support for the OpenBSD DLT_LOOP. Based on handling of these DLT types from tcpdump.c.
@@ -432,10 +432,15 @@ static void handle_raw_packet(unsigned char* args, const struct pcap_pkthdr* pkthdr, const unsigned char* packet) { handle_ip_packet((struct ip*)packet, -1); }
+static void handle_null_packet(unsigned char* args, const struct pcap_pkthdr* pkthdr, const unsigned char* packet) +{ + handle_ip_packet((struct ip*)(packet+4), -1); +} + #ifdef DLT_PFLOG static void handle_pflog_packet(unsigned char* args, const struct pcap_pkthdr* pkthdr, const unsigned char* packet) { register u_int length = pkthdr->len; u_int hdrlen; @@ -680,13 +685,21 @@ #ifdef DLT_PFLOG else if (dlt == DLT_PFLOG) { packet_handler = handle_pflog_packet; } #endif - else if(dlt == DLT_RAW || dlt == DLT_NULL) { + else if(dlt == DLT_RAW) { packet_handler = handle_raw_packet; } + else if(dlt == DLT_NULL) { + packet_handler = handle_null_packet; + } +#ifdef DLT_LOOP + else if(dlt == DLT_LOOP) { + packet_handler = handle_null_packet; + } +#endif else if(dlt == DLT_IEEE802) { packet_handler = handle_tokenring_packet; } else if(dlt == DLT_PPP) { packet_handler = handle_ppp_packet;