diff options
author | peter <peter@FreeBSD.org> | 1997-11-16 04:52:19 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1997-11-16 04:52:19 +0000 |
commit | 594e73c3109178aa1c5317785aaa284a0c135ff4 (patch) | |
tree | 1abde20e1d717a2bf3509de2189cbe7fa3c9f91e /contrib/ipfilter/ipft_tx.c | |
parent | c4dc16ff2222e864e5ab4d236e0de3a2cb5b54da (diff) | |
download | FreeBSD-src-594e73c3109178aa1c5317785aaa284a0c135ff4.zip FreeBSD-src-594e73c3109178aa1c5317785aaa284a0c135ff4.tar.gz |
Import ipfilter 3.2.1 (update from 3.1.8)
Diffstat (limited to 'contrib/ipfilter/ipft_tx.c')
-rw-r--r-- | contrib/ipfilter/ipft_tx.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/contrib/ipfilter/ipft_tx.c b/contrib/ipfilter/ipft_tx.c index 04e5e3f..9be852b 100644 --- a/contrib/ipfilter/ipft_tx.c +++ b/contrib/ipfilter/ipft_tx.c @@ -1,5 +1,5 @@ /* - * (C)opyright 1995 by Darren Reed. + * Copyright (C) 1995-1997 by Darren Reed. * * Redistribution and use in source and binary forms are permitted * provided that this notice is preserved and due credit is given @@ -9,12 +9,12 @@ #include <ctype.h> #include <assert.h> #include <string.h> +#include <sys/types.h> #if !defined(__SVR4) && !defined(__svr4__) #include <strings.h> #else #include <sys/byteorder.h> #endif -#include <sys/types.h> #include <sys/param.h> #include <sys/time.h> #include <stdlib.h> @@ -24,34 +24,35 @@ #include <sys/ioctl.h> #include <netinet/in.h> #include <netinet/in_systm.h> +#ifndef linux #include <netinet/ip_var.h> +#endif #include <netinet/ip.h> #include <netinet/udp.h> #include <netinet/tcp.h> #include <netinet/ip_icmp.h> -#include <netinet/tcpip.h> #include <arpa/inet.h> #include <net/if.h> #include <netdb.h> #include <arpa/nameser.h> #include <resolv.h> #include "ip_compat.h" +#include <netinet/tcpip.h> #include "ipf.h" #include "ipt.h" -#if !defined(lint) && defined(LIBC_SCCS) -static char sccsid[] = "@(#)ipft_tx.c 1.7 6/5/96 (C) 1993 Darren Reed"; -static char rcsid[] = "$Id: ipft_tx.c,v 2.0.2.4 1997/04/30 13:55:13 darrenr Exp $"; +#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 2.0.2.11.2.1 1997/11/12 10:56:11 darrenr Exp $"; #endif extern int opts; -extern u_long buildopts __P((char *, char *)); static char *tx_proto = ""; static int text_open __P((char *)), text_close __P((void)); static int text_readip __P((char *, int, char **, int *)); -static int parseline __P((char *, struct ip *, char **, int *)); +static int parseline __P((char *, ip_t *, char **, int *)); static char tcp_flagset[] = "FSRPAU"; static u_char tcp_flags[] = { TH_FIN, TH_SYN, TH_RST, TH_PUSH, @@ -90,7 +91,7 @@ int *resolved; } return np->n_net; } - return *(u_long *)hp->h_addr; + return *(u_32_t *)hp->h_addr; } @@ -136,8 +137,8 @@ char *name; char *tx_icmptypes[] = { "echorep", (char *)NULL, (char *)NULL, "unreach", "squench", - "redir", (char *)NULL, (char *)NULL, "echo", (char *)NULL, - (char *)NULL, "timex", "paramprob", "timest", "timestrep", + "redir", (char *)NULL, (char *)NULL, "echo", "routerad", + "routersol", "timex", "paramprob", "timest", "timestrep", "inforeq", "inforep", "maskreq", "maskrep", "END" }; @@ -175,10 +176,10 @@ char *buf, **ifn; int cnt, *dir; { register char *s; - struct ip *ip; + ip_t *ip; char line[513]; - ip = (struct ip *)buf; + ip = (ip_t *)buf; *ifn = NULL; while (fgets(line, sizeof(line)-1, tfp)) { if ((s = index(line, '\n'))) @@ -193,11 +194,11 @@ int cnt, *dir; printf("input: %s\n", line); *ifn = NULL; *dir = 0; - if (!parseline(line, (struct ip *)buf, ifn, dir)) + if (!parseline(line, (ip_t *)buf, ifn, dir)) #if 0 return sizeof(struct tcpiphdr); #else - return sizeof(struct ip); + return sizeof(ip_t); #endif } return -1; @@ -205,7 +206,7 @@ int cnt, *dir; static int parseline(line, ip, ifn, out) char *line; -struct ip *ip; +ip_t *ip; char **ifn; int *out; { @@ -245,7 +246,7 @@ int *out; } c = **cpp; - ip->ip_len = sizeof(struct ip); + ip->ip_len = sizeof(ip_t); if (!strcasecmp(*cpp, "tcp") || !strcasecmp(*cpp, "udp") || !strcasecmp(*cpp, "icmp")) { if (c == 't') { @@ -327,7 +328,7 @@ int *out; u_long olen; cpp++; - olen = buildopts(*cpp, ipopts); + olen = buildopts(*cpp, ipopts, (ip->ip_hl - 5) << 2); if (olen) { bcopy(ipopts, (char *)(ip + 1), olen); ip->ip_hl += olen >> 2; |