summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpattonme <pattonme@cvs.openbsd.org>1998-09-15 10:05:53 +0000
committerpattonme <pattonme@cvs.openbsd.org>1998-09-15 10:05:53 +0000
commit6afefb3a3fa727e36bf896a9638f23d65fc9e84e (patch)
treeb9cddc59fc02c6fec18bdca069bd614d53e1944c
parentc0f676e69bfd829b82362fc6d313182c34d70937 (diff)
updated to v3.2.9 of Darren's codebase. His code reimplements variable
locking, replaces u_long's with u_32_t to properly handle 64bit archs. Wrapped OpenBSD specific preprocessor logic.
-rw-r--r--usr.sbin/ipftest/Makefile6
-rw-r--r--usr.sbin/ipftest/ipft_ef.c10
-rw-r--r--usr.sbin/ipftest/ipft_hx.c10
-rw-r--r--usr.sbin/ipftest/ipft_pc.c16
-rw-r--r--usr.sbin/ipftest/ipft_sn.c10
-rw-r--r--usr.sbin/ipftest/ipft_td.c10
-rw-r--r--usr.sbin/ipftest/ipft_tx.c16
-rw-r--r--usr.sbin/ipftest/ipftest.16
-rw-r--r--usr.sbin/ipftest/ipt.c12
-rw-r--r--usr.sbin/ipftest/misc.c15
10 files changed, 70 insertions, 41 deletions
diff --git a/usr.sbin/ipftest/Makefile b/usr.sbin/ipftest/Makefile
index c25f5edad0e..2e6697dac82 100644
--- a/usr.sbin/ipftest/Makefile
+++ b/usr.sbin/ipftest/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.5 1998/01/26 04:16:31 dgregor Exp $
+# $OpenBSD: Makefile,v 1.6 1998/09/15 10:05:46 pattonme Exp $
PROG= ipftest
MAN= ipftest.1
@@ -9,8 +9,8 @@ SRCS= ipt.c fil.c ipft_hx.c ipft_sn.c ipft_ef.c ipft_td.c ipft_pc.c \
.PATH: ${.CURDIR}/../../sbin/ipf ${.CURDIR}/../../sbin/ipfstat \
${.CURDIR}/../../sys/netinet
-CFLAGS+=-DIPL_NAME=\"/dev/ipl\" -I${.CURDIR}/../../sbin/ipf \
- -I${.CURDIR}/../../sys/netinet -I${.CURDIR}
+CFLAGS+=-I${.CURDIR}/../../sbin/ipf \
+ -I${.CURDIR}
.include <bsd.prog.mk>
diff --git a/usr.sbin/ipftest/ipft_ef.c b/usr.sbin/ipftest/ipft_ef.c
index 8ba0f379027..c961b38cb5b 100644
--- a/usr.sbin/ipftest/ipft_ef.c
+++ b/usr.sbin/ipftest/ipft_ef.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipft_ef.c,v 1.8 1998/01/26 04:16:32 dgregor Exp $ */
+/* $OpenBSD: ipft_ef.c,v 1.9 1998/09/15 10:05:50 pattonme Exp $ */
/*
* Copyright (C) 1993-1997 by Darren Reed.
*
@@ -45,14 +45,18 @@ etherfind -n -t
#include <netinet/ip_icmp.h>
#include <net/if.h>
#include <netdb.h>
-#include "ip_fil_compat.h"
+#if defined(__OpenBSD__)
+# include <netinet/ip_fil_compat.h>
+#else
+# include <netinet/ip_compat.h>
+#endif
#include <netinet/tcpip.h>
#include "ipf.h"
#include "ipt.h"
#if !defined(lint)
static const char sccsid[] = "@(#)ipft_ef.c 1.6 2/4/96 (C)1995 Darren Reed";
-static const char rcsid[] = "@(#)$Id: ipft_ef.c,v 1.8 1998/01/26 04:16:32 dgregor Exp $";
+static const char rcsid[] = "@(#)$Id: ipft_ef.c,v 1.9 1998/09/15 10:05:50 pattonme Exp $";
#endif
static int etherf_open __P((char *));
diff --git a/usr.sbin/ipftest/ipft_hx.c b/usr.sbin/ipftest/ipft_hx.c
index 94b5eb5c3ca..50f7d7770c9 100644
--- a/usr.sbin/ipftest/ipft_hx.c
+++ b/usr.sbin/ipftest/ipft_hx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipft_hx.c,v 1.6 1998/01/26 04:16:34 dgregor Exp $ */
+/* $OpenBSD: ipft_hx.c,v 1.7 1998/09/15 10:05:50 pattonme Exp $ */
/*
* Copyright (C) 1995-1997 by Darren Reed.
*
@@ -36,14 +36,18 @@
#include <netdb.h>
#include <arpa/nameser.h>
#include <resolv.h>
-#include "ip_fil_compat.h"
+#if defined(__OpenBSD__)
+# include <netinet/ip_fil_compat.h>
+#else
+# include <netinet/ip_compat.h>
+#endif
#include <netinet/tcpip.h>
#include "ipf.h"
#include "ipt.h"
#if !defined(lint)
static const char sccsid[] = "@(#)ipft_hx.c 1.1 3/9/96 (C) 1996 Darren Reed";
-static const char rcsid[] = "@(#)$Id: ipft_hx.c,v 1.6 1998/01/26 04:16:34 dgregor Exp $";
+static const char rcsid[] = "@(#)$Id: ipft_hx.c,v 1.7 1998/09/15 10:05:50 pattonme Exp $";
#endif
extern int opts;
diff --git a/usr.sbin/ipftest/ipft_pc.c b/usr.sbin/ipftest/ipft_pc.c
index 96fb0f08c7f..7cf6e934834 100644
--- a/usr.sbin/ipftest/ipft_pc.c
+++ b/usr.sbin/ipftest/ipft_pc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipft_pc.c,v 1.10 1998/06/11 00:01:20 provos Exp $ */
+/* $OpenBSD: ipft_pc.c,v 1.11 1998/09/15 10:05:50 pattonme Exp $ */
/*
* Copyright (C) 1993-1997 by Darren Reed.
*
@@ -27,14 +27,18 @@
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <net/if.h>
-#include "ip_fil_compat.h"
+#if defined(__OpenBSD__)
+# include <netinet/ip_fil_compat.h>
+#else
+# include <netinet/ip_compat.h>
+#endif
#include <netinet/tcpip.h>
#include "ipf.h"
#include "ipt.h"
#include "pcap.h"
#if !defined(lint)
-static const char rcsid[] = "@(#)$Id: ipft_pc.c,v 1.10 1998/06/11 00:01:20 provos Exp $";
+static const char rcsid[] = "@(#)$Id: ipft_pc.c,v 1.11 1998/09/15 10:05:50 pattonme Exp $";
#endif
struct llc {
@@ -47,9 +51,9 @@ struct llc {
* While many of these maybe the same, some do have different header formats
* which make this useful.
*/
-#define DLT_MAX 12
+#define DLT_MAX 14
-static struct llc llcs[DLT_MAX+1] = {
+static struct llc llcs[DLT_MAX] = {
{ 0, 0, 0 }, /* DLT_NULL */
{ 14, 12, 2 }, /* DLT_E10MB */
{ 0, 0, 0 }, /* DLT_EN3MB */
@@ -118,7 +122,7 @@ char *fname;
swap_hdr(&ph);
}
- if (ph.pc_v_maj != PCAP_VERSION_MAJ || ph.pc_type > DLT_MAX) {
+ if (ph.pc_v_maj != PCAP_VERSION_MAJ || ph.pc_type >= DLT_MAX) {
(void) close(fd);
return -2;
}
diff --git a/usr.sbin/ipftest/ipft_sn.c b/usr.sbin/ipftest/ipft_sn.c
index 48d643511f2..6d33620e40b 100644
--- a/usr.sbin/ipftest/ipft_sn.c
+++ b/usr.sbin/ipftest/ipft_sn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipft_sn.c,v 1.7 1998/01/26 04:16:36 dgregor Exp $ */
+/* $OpenBSD: ipft_sn.c,v 1.8 1998/09/15 10:05:50 pattonme Exp $ */
/*
* Copyright (C) 1993-1997 by Darren Reed.
*
@@ -31,14 +31,18 @@
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <net/if.h>
-#include "ip_fil_compat.h"
+#if defined(__OpenBSD__)
+# include <netinet/ip_fil_compat.h>
+#else
+# include <netinet/ip_compat.h>
+#endif
#include <netinet/tcpip.h>
#include "ipf.h"
#include "ipt.h"
#include "snoop.h"
#if !defined(lint)
-static const char rcsid[] = "@(#)$Id: ipft_sn.c,v 1.7 1998/01/26 04:16:36 dgregor Exp $";
+static const char rcsid[] = "@(#)$Id: ipft_sn.c,v 1.8 1998/09/15 10:05:50 pattonme Exp $";
#endif
struct llc {
diff --git a/usr.sbin/ipftest/ipft_td.c b/usr.sbin/ipftest/ipft_td.c
index 67385f78a41..7251150678a 100644
--- a/usr.sbin/ipftest/ipft_td.c
+++ b/usr.sbin/ipftest/ipft_td.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipft_td.c,v 1.8 1998/01/26 04:16:37 dgregor Exp $ */
+/* $OpenBSD: ipft_td.c,v 1.9 1998/09/15 10:05:51 pattonme Exp $ */
/*
* Copyright (C) 1993-1997 by Darren Reed.
*
@@ -54,14 +54,18 @@ tcpdump -nqte
#include <netinet/ip_icmp.h>
#include <net/if.h>
#include <netdb.h>
-#include "ip_fil_compat.h"
+#if defined(__OpenBSD__)
+# include <netinet/ip_fil_compat.h>
+#else
+# include <netinet/ip_compat.h>
+#endif
#include <netinet/tcpip.h>
#include "ipf.h"
#include "ipt.h"
#if !defined(lint)
static const char sccsid[] = "@(#)ipft_td.c 1.8 2/4/96 (C)1995 Darren Reed";
-static const char rcsid[] = "@(#)$Id: ipft_td.c,v 1.8 1998/01/26 04:16:37 dgregor Exp $";
+static const char rcsid[] = "@(#)$Id: ipft_td.c,v 1.9 1998/09/15 10:05:51 pattonme Exp $";
#endif
static int tcpd_open __P((char *));
diff --git a/usr.sbin/ipftest/ipft_tx.c b/usr.sbin/ipftest/ipft_tx.c
index 74cb4ee3cf6..343cb1dcee7 100644
--- a/usr.sbin/ipftest/ipft_tx.c
+++ b/usr.sbin/ipftest/ipft_tx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipft_tx.c,v 1.10 1998/01/26 04:16:38 dgregor Exp $ */
+/* $OpenBSD: ipft_tx.c,v 1.11 1998/09/15 10:05:51 pattonme Exp $ */
/*
* Copyright (C) 1995-1997 by Darren Reed.
*
@@ -37,14 +37,18 @@
#include <netdb.h>
#include <arpa/nameser.h>
#include <resolv.h>
-#include "ip_fil_compat.h"
+#if defined(__OpenBSD__)
+# include <netinet/ip_fil_compat.h>
+#else
+# include <netinet/ip_compat.h>
+#endif
#include <netinet/tcpip.h>
#include "ipf.h"
#include "ipt.h"
#if !defined(lint)
static const char sccsid[] = "@(#)ipft_tx.c 1.7 6/5/96 (C) 1993 Darren Reed";
-static const char rcsid[] = "@(#)$Id: ipft_tx.c,v 1.10 1998/01/26 04:16:38 dgregor Exp $";
+static const char rcsid[] = "@(#)$Id: ipft_tx.c,v 1.11 1998/09/15 10:05:51 pattonme Exp $";
#endif
extern int opts;
@@ -63,7 +67,7 @@ struct ipread iptext = { text_open, text_close, text_readip };
static FILE *tfp = NULL;
static int tfd = -1;
-static u_long tx_hostnum __P((char *, int *));
+static u_32_t tx_hostnum __P((char *, int *));
static u_short tx_portnum __P((char *));
@@ -71,7 +75,7 @@ static u_short tx_portnum __P((char *));
* returns an ip address as a long var as a result of either a DNS lookup or
* straight inet_addr() call
*/
-static u_long tx_hostnum(host, resolved)
+static u_32_t tx_hostnum(host, resolved)
char *host;
int *resolved;
{
@@ -90,7 +94,7 @@ int *resolved;
fprintf(stderr, "can't resolve hostname: %s\n", host);
return 0;
}
- return np->n_net;
+ return htonl(np->n_net);
}
return *(u_32_t *)hp->h_addr;
}
diff --git a/usr.sbin/ipftest/ipftest.1 b/usr.sbin/ipftest/ipftest.1
index 6e22ab15299..4793f3ea777 100644
--- a/usr.sbin/ipftest/ipftest.1
+++ b/usr.sbin/ipftest/ipftest.1
@@ -1,5 +1,5 @@
-.\" $OpenBSD: ipftest.1,v 1.5 1998/01/26 04:16:39 dgregor Exp $
-.TH ipftest 8
+.\" $OpenBSD: ipftest.1,v 1.6 1998/09/15 10:05:51 pattonme Exp $
+.TH ipftest 1
.SH NAME
ipftest \- test packet filter rules with arbitrary input.
.SH SYNOPSIS
@@ -122,7 +122,7 @@ Specify the filename from which to take input. Default is stdin.
Specify the filename from which to read filter rules.
.SH FILES
.SH SEE ALSO
-ipf(8), ipf(5), snoop(1m), tcpdump(8), etherfind(8c)
+ipf(1), ipf(5), snoop(1m), tcpdump(8), etherfind(8c)
.SH BUGS
Not all of the input formats are sufficiently capable of introducing a
wide enough variety of packets for them to be all useful in testing.
diff --git a/usr.sbin/ipftest/ipt.c b/usr.sbin/ipftest/ipt.c
index 76d687c7bff..9ed2c549103 100644
--- a/usr.sbin/ipftest/ipt.c
+++ b/usr.sbin/ipftest/ipt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipt.c,v 1.11 1998/01/26 04:16:40 dgregor Exp $ */
+/* $OpenBSD: ipt.c,v 1.12 1998/09/15 10:05:51 pattonme Exp $ */
/*
* Copyright (C) 1993-1997 by Darren Reed.
*
@@ -46,15 +46,19 @@
#include <arpa/inet.h>
#include <resolv.h>
#include <ctype.h>
-#include "ip_fil_compat.h"
+#if defined(__OpenBSD__)
+# include <netinet/ip_fil_compat.h>
+#else
+# include <netinet/ip_compat.h>
+#endif
#include <netinet/tcpip.h>
-#include "ip_fil.h"
+#include <netinet/ip_fil.h>
#include "ipf.h"
#include "ipt.h"
#if !defined(lint)
static const char sccsid[] = "@(#)ipt.c 1.19 6/3/96 (C) 1993-1996 Darren Reed";
-static const char rcsid[] = "@(#)$Id: ipt.c,v 1.11 1998/01/26 04:16:40 dgregor Exp $";
+static const char rcsid[] = "@(#)$Id: ipt.c,v 1.12 1998/09/15 10:05:51 pattonme Exp $";
#endif
extern char *optarg;
diff --git a/usr.sbin/ipftest/misc.c b/usr.sbin/ipftest/misc.c
index 20f100c32cf..8aa045af839 100644
--- a/usr.sbin/ipftest/misc.c
+++ b/usr.sbin/ipftest/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.6 1998/01/26 04:16:42 dgregor Exp $ */
+/* $OpenBSD: misc.c,v 1.7 1998/09/15 10:05:52 pattonme Exp $ */
/*
* Copyright (C) 1993-1997 by Darren Reed.
*
@@ -28,9 +28,6 @@
#ifndef linux
#include <netinet/ip_var.h>
#endif
-#ifdef __OpenBSD__
-#include <machine/stdarg.h>
-#endif
#include <netinet/ip.h>
#include <netinet/udp.h>
#include <netinet/tcp.h>
@@ -39,15 +36,19 @@
#include <netdb.h>
#include <arpa/nameser.h>
#include <resolv.h>
-#include "ip_fil_compat.h"
+#if defined(__OpenBSD__)
+# include <netinet/ip_fil_compat.h>
+#else
+# include <netinet/ip_compat.h>
+#endif
#include <netinet/tcpip.h>
-#include "ip_fil.h"
+#include <netinet/ip_fil.h>
#include "ipf.h"
#include "ipt.h"
#if !defined(lint)
static const char sccsid[] = "@(#)misc.c 1.3 2/4/96 (C) 1995 Darren Reed";
-static const char rcsid[] = "@(#)$Id: misc.c,v 1.6 1998/01/26 04:16:42 dgregor Exp $";
+static const char rcsid[] = "@(#)$Id: misc.c,v 1.7 1998/09/15 10:05:52 pattonme Exp $";
#endif
extern int opts;