Deleted Added
full compact
ipftest.c (153881) ipftest.c (161357)
1/* $FreeBSD: head/contrib/ipfilter/tools/ipftest.c 153881 2005-12-30 11:52:26Z guido $ */
1/* $FreeBSD: head/contrib/ipfilter/tools/ipftest.c 161357 2006-08-16 12:23:02Z guido $ */
2
3/*
4 * Copyright (C) 1993-2001 by Darren Reed.
5 *
6 * See the IPFILTER.LICENCE file for details on licencing.
7 */
8#include "ipf.h"
9#include "ipt.h"
10#include <sys/ioctl.h>
11#include <sys/file.h>
12
13#if !defined(lint)
14static const char sccsid[] = "@(#)ipt.c 1.19 6/3/96 (C) 1993-2000 Darren Reed";
2
3/*
4 * Copyright (C) 1993-2001 by Darren Reed.
5 *
6 * See the IPFILTER.LICENCE file for details on licencing.
7 */
8#include "ipf.h"
9#include "ipt.h"
10#include <sys/ioctl.h>
11#include <sys/file.h>
12
13#if !defined(lint)
14static const char sccsid[] = "@(#)ipt.c 1.19 6/3/96 (C) 1993-2000 Darren Reed";
15static const char rcsid[] = "@(#)$Id: ipftest.c,v 1.44.2.7 2005/12/07 08:29:19 darrenr Exp $";
15static const char rcsid[] = "@(#)$Id: ipftest.c,v 1.44.2.9 2006/03/29 11:21:13 darrenr Exp $";
16#endif
17
18extern char *optarg;
19extern struct frentry *ipfilter[2][2];
20extern struct ipread snoop, etherf, tcpd, pcap, iptext, iphex;
21extern struct ifnet *get_unit __P((char *, int));
22extern void init_ifp __P((void));
23extern ipnat_t *natparse __P((char *, int));

--- 183 unchanged lines hidden (view full) ---

207 fd = (*r->r_open)("-");
208
209 if (fd < 0)
210 exit(-1);
211
212 ip = MTOD(m, ip_t *);
213 while ((i = (*r->r_readip)(MTOD(m, char *), sizeof(m->mb_buf),
214 &iface, &dir)) > 0) {
16#endif
17
18extern char *optarg;
19extern struct frentry *ipfilter[2][2];
20extern struct ipread snoop, etherf, tcpd, pcap, iptext, iphex;
21extern struct ifnet *get_unit __P((char *, int));
22extern void init_ifp __P((void));
23extern ipnat_t *natparse __P((char *, int));

--- 183 unchanged lines hidden (view full) ---

207 fd = (*r->r_open)("-");
208
209 if (fd < 0)
210 exit(-1);
211
212 ip = MTOD(m, ip_t *);
213 while ((i = (*r->r_readip)(MTOD(m, char *), sizeof(m->mb_buf),
214 &iface, &dir)) > 0) {
215 if (iface == NULL || *iface == '\0')
215 if ((iface == NULL) || (*iface == '\0'))
216 iface = ifname;
217 ifp = get_unit(iface, IP_V(ip));
218 if (!use_inet6) {
219 ip->ip_off = ntohs(ip->ip_off);
220 ip->ip_len = ntohs(ip->ip_len);
221 if ((r->r_flags & R_DO_CKSUM) || docksum)
222 fixv4sums(m, ip);
223 hlen = IP_HL(ip) << 2;

--- 570 unchanged lines hidden (view full) ---

794 break;
795 default :
796 csump = NULL;
797 hdr = NULL;
798 break;
799 }
800 if (hdr != NULL) {
801 *csump = 0;
216 iface = ifname;
217 ifp = get_unit(iface, IP_V(ip));
218 if (!use_inet6) {
219 ip->ip_off = ntohs(ip->ip_off);
220 ip->ip_len = ntohs(ip->ip_len);
221 if ((r->r_flags & R_DO_CKSUM) || docksum)
222 fixv4sums(m, ip);
223 hlen = IP_HL(ip) << 2;

--- 570 unchanged lines hidden (view full) ---

794 break;
795 default :
796 csump = NULL;
797 hdr = NULL;
798 break;
799 }
800 if (hdr != NULL) {
801 *csump = 0;
802 *(u_short *)csump = fr_cksum(m, ip, ip->ip_p, hdr);
802 *(u_short *)csump = fr_cksum(m, ip, ip->ip_p, hdr, ip->ip_len);
803 }
804}
803 }
804}