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_hx.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_hx.c')
-rw-r--r-- | contrib/ipfilter/ipft_hx.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/contrib/ipfilter/ipft_hx.c b/contrib/ipfilter/ipft_hx.c index 30b3d6d..c7fcd92 100644 --- a/contrib/ipfilter/ipft_hx.c +++ b/contrib/ipfilter/ipft_hx.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,23 +24,25 @@ #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 <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_hx.c 1.1 3/9/96 (C) 1996 Darren Reed"; -static char rcsid[] = "$Id: ipft_hx.c,v 2.0.2.4 1997/04/30 13:55:07 darrenr Exp $"; +#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 2.0.2.8.2.1 1997/11/12 10:56:07 darrenr Exp $"; #endif extern int opts; @@ -88,10 +90,10 @@ char *buf, **ifn; int cnt, *dir; { register char *s, *t, *u; - struct ip *ip; char line[513]; + ip_t *ip; - ip = (struct ip *)buf; + ip = (ip_t *)buf; while (fgets(line, sizeof(line)-1, tfp)) { if ((s = index(line, '\n'))) { if (s == line) @@ -111,25 +113,30 @@ int cnt, *dir; * interpret start of line as possibly "[ifname]" or * "[in/out,ifname]". */ - *ifn = NULL; - *dir = 0; + if (ifn) + *ifn = NULL; + if (dir) + *dir = 0; if ((*buf == '[') && (s = index(line, ']'))) { t = buf + 1; if (t - s > 0) { if ((u = index(t, ',')) && (u < s)) { u++; - *ifn = u; - if (*t == 'i') - *dir = 0; - else if (*t == 'o') - *dir = 1; - } else + if (ifn) + *ifn = u; + if (dir) { + if (*t == 'i') + *dir = 0; + else if (*t == 'o') + *dir = 1; + } + } else if (ifn) *ifn = t; *s++ = '\0'; } } else s = line; - ip = (struct ip *)readhex(s, (char *)ip); + ip = (ip_t *)readhex(s, (char *)ip); } return -1; } |