diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2001-01-17 06:01:28 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2001-01-17 06:01:28 +0000 |
commit | c67f44fa2629f6f91d78058ce671d7113007bb22 (patch) | |
tree | 28dd7e9da83f6bc5a58e7a33cd87cd6c50682c96 /usr.sbin/ipftest/ipt.c | |
parent | bf383cd8b01ace1511e5268fae78582cc3c22406 (diff) |
2nd part of the ipf code; need more testing.
Diffstat (limited to 'usr.sbin/ipftest/ipt.c')
-rw-r--r-- | usr.sbin/ipftest/ipt.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/usr.sbin/ipftest/ipt.c b/usr.sbin/ipftest/ipt.c index 4e6f6aa60f6..755f1552df9 100644 --- a/usr.sbin/ipftest/ipt.c +++ b/usr.sbin/ipftest/ipt.c @@ -1,7 +1,7 @@ -/* $OpenBSD: ipt.c,v 1.17 2000/03/13 23:40:20 kjell Exp $ */ +/* $OpenBSD: ipt.c,v 1.18 2001/01/17 06:01:22 fgsch Exp $ */ /* - * Copyright (C) 1993-1998 by Darren Reed. + * Copyright (C) 1993-2000 by Darren Reed. * * Redistribution and use in source and binary forms are permitted * provided that this notice is preserved and due credit is given @@ -47,7 +47,7 @@ #include <arpa/inet.h> #include <resolv.h> #include <ctype.h> -#include <netinet/ip_fil_compat.h> +#include <netinet/ip_compat.h> #include <netinet/tcpip.h> #include <netinet/ip_fil.h> #include <netinet/ip_nat.h> @@ -56,19 +56,22 @@ #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[] = "@(#)$IPFilter: ipt.c,v 2.1.2.1 2000/01/24 14:49:11 darrenr Exp $"; +static const char sccsid[] = "@(#)ipt.c 1.19 6/3/96 (C) 1993-2000 Darren Reed"; +static const char rcsid[] = "@(#)$IPFilter: ipt.c,v 2.6 2000/03/13 22:10:25 darrenr Exp $"; #endif extern char *optarg; extern struct frentry *ipfilter[2][2]; extern struct ipread snoop, etherf, tcpd, pcap, iptext, iphex; -extern struct ifnet *get_unit __P((char *)); +extern struct ifnet *get_unit __P((char *, int)); extern void init_ifp __P((void)); extern ipnat_t *natparse __P((char *, int)); extern int fr_running; int opts = 0; +#ifdef USE_INET6 +int use_inet6 = 0; +#endif int main __P((int, char *[])); int main(argc,argv) @@ -82,9 +85,14 @@ char *argv[]; ip_t *ip; int fd, i, dir = 0, c; - while ((c = getopt(argc, argv, "bdEHi:I:NoPr:STvX")) != -1) + while ((c = getopt(argc, argv, "6bdEHi:I:NoPr:STvX")) != -1) switch (c) { +#ifdef USE_INET6 + case '6' : + use_inet6 = 1; + break; +#endif case 'b' : opts |= OPT_BRIEF; break; @@ -177,7 +185,8 @@ char *argv[]; if (!(fr = natparse(line, linenum))) continue; i = IPL_EXTERN(ioctl)(IPL_LOGNAT, SIOCADNAT, - fr, FWRITE|FREAD); + (caddr_t)&fr, + FWRITE|FREAD); if (opts & OPT_DEBUG) fprintf(stderr, "iplioctl(ADNAT,%p,1) = %d\n", @@ -185,11 +194,12 @@ char *argv[]; } else { if (!(fr = parse(line, linenum))) continue; - i = IPL_EXTERN(ioctl)(0, SIOCADDFR, fr, + i = IPL_EXTERN(ioctl)(0, SIOCADAFR, + (caddr_t)&fr, FWRITE|FREAD); if (opts & OPT_DEBUG) fprintf(stderr, - "iplioctl(ADDFR,%p,1) = %d\n", + "iplioctl(ADAFR,%p,1) = %d\n", fr, i); } } @@ -210,7 +220,7 @@ char *argv[]; ip = (ip_t *)buf; while ((i = (*r->r_readip)((char *)buf, sizeof(buf), &iface, &dir)) > 0) { - ifp = iface ? get_unit(iface) : NULL; + ifp = iface ? get_unit(iface, ip->ip_v) : NULL; ip->ip_off = ntohs(ip->ip_off); ip->ip_len = ntohs(ip->ip_len); i = fr_check(ip, ip->ip_hl << 2, ifp, dir, (mb_t **)&buf); |