$OpenBSD: patch-src_ipaudit_c,v 1.4 2018/04/25 19:44:04 naddy Exp $
Index: src/ipaudit.c
--- src/ipaudit.c.orig
+++ src/ipaudit.c
@@ -40,6 +40,9 @@ Include Files
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#include <errno.h>
 #include <string.h>
 #include <pcap.h>
 #include <signal.h>
@@ -50,7 +53,13 @@ Include Files
 #include <netinet/in.h>
 #include "hash.h"
 
+#ifdef DLT_PFLOG
+#include <net/if_pflog.h>
+#endif
 
+#ifdef DLT_ENC
+#include <net/if_enc.h>
+#endif
 
 /*
 ------------------------------------------------------------------------
@@ -217,7 +226,6 @@ typedef struct {
 Global variables
 ------------------------------------------------------------------------
 */
-extern int errno;
 extern char pcap_version[];
 
 
@@ -434,6 +442,16 @@ if (debug_m) {
 				printf ("DataLinkType = %s\n", "DLT_RAW"); break;
 			case DLT_ATM_RFC1483: 
 				printf ("DataLinkType = %s\n", "DLT_ATM_RFC1483"); break;
+			case DLT_LOOP:
+				printf ("DataLinkType = %s\n", "DLT_LOOP"); break;
+			case DLT_ENC:
+				printf ("DataLinkType = %s\n", "DLT_ENC"); break;
+			case DLT_PPP_ETHER: 
+				printf ("DataLinkType = %s\n", "DLT_PPP_ETHER"); break;
+			case DLT_PFLOG: 
+				printf ("DataLinkType = %s\n", "DLT_PFLOG"); break;
+			case DLT_PFSYNC: 
+				printf ("DataLinkType = %s\n", "DLT_PFSYNC"); break;
 			default:
 				printf ("DataLinkType = %d\n", DataLinkType);
 		}
@@ -1278,6 +1296,19 @@ int get_packetoffset (int DataLinkType) {
 		case DLT_NULL:
 			PacketOffset = POFF_NULL;
 			break;
+		case DLT_LOOP:
+		case DLT_PFSYNC:
+			PacketOffset = 4;
+			break;
+		case DLT_PPP_ETHER:
+			PacketOffset = 8;
+			break;
+		case DLT_ENC:
+			PacketOffset = ENC_HDRLEN;
+                        break;
+		case DLT_PFLOG:
+			PacketOffset = PFLOG_HDRLEN;
+                        break;
 		/*  Currently only know ethernet, ppp, for others we guess  */
 		default:
 			PacketOffset = 0;
@@ -1465,7 +1496,7 @@ void split (char *instr, char ***list, int *nlist) {
 
 /*  Read options from command line  */
 void read_options (int argc, char *argv[]) {
-	char optchar;
+	int optchar;
 	while (-1 != (optchar=getopt(argc,argv,"CGHI:L:MN:Sabc:dei:f:g:l:mo:p:r:s:tx:w:v"))) {
 		switch (optchar) {
 		case '?':
