ipfilter #ifdef cleanup.

Remove #ifdefs for ancient and irrelevant operating systems from
ipfilter.

When ipfilter was written the UNIX and UNIX-like systems in use
were diverse and plentiful. IRIX, Tru64 (OSF/1) don't exist any
more. OpenBSD removed ipfilter shortly after the first time the
ipfilter license terms changed in the early 2000's. ipfilter on AIX,
HP/UX, and Linux never really caught on. Removal of code for operating
systems that ipfilter will never run on again will simplify the code
making it easier to fix bugs, complete partially implemented features,
and extend ipfilter.

Unsupported previous version FreeBSD code and some older NetBSD code
has also been removed.

What remains is supported FreeBSD, NetBSD, and illumos. FreeBSD and
NetBSD have collaborated exchanging patches, while illumos has expressed
willingness to have their ipfilter updated to 5.1.2, provided their
zone-specific updates to their ipfilter are merged (which are of interest
to FreeBSD to allow control of ipfilters in jails from the global zone).

Reviewed by:	glebius@
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D19006
This commit is contained in:
Cy Schubert 2019-02-03 05:25:49 +00:00
parent b90dad3524
commit 0fcd8cab4e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=343701
54 changed files with 126 additions and 1250 deletions

View File

@ -7,7 +7,7 @@
*
* Dan Moschuk
*/
#if !defined(SOLARIS2) && !defined(__osf__)
#if !defined(SOLARIS2)
# include <sys/cdefs.h>
#endif
@ -16,26 +16,16 @@
#ifdef __FreeBSD__
# include <sys/kernel.h>
#endif
#if !defined(__osf__)
# include <sys/random.h>
#endif
#ifdef __FreeBSD__
# include <sys/libkern.h>
#endif
#include <sys/lock.h>
#ifndef __osf__
# include <sys/mutex.h>
#endif
#include <sys/time.h>
#if defined(SOLARIS2) && (SOLARIS2 < 9)
# include <netinet/in_systm.h>
#endif
#include <sys/socket.h>
#include <net/if.h>
#ifdef __osf__
# include <net/route.h>
#endif
#include <netinet/in.h>
#include <netinet/ip.h>
#include "netinet/ip_compat.h"

View File

@ -9,9 +9,6 @@
# define KERNEL 1
# define _KERNEL 1
#endif
#if defined(__osf__)
# define _PROTO_NET_H_
#endif
#include <sys/errno.h>
#include <sys/types.h>
#include <sys/param.h>
@ -21,9 +18,6 @@
# include <stdlib.h>
# include <string.h>
# define _KERNEL
# ifdef __OpenBSD__
struct file;
# endif
# include <sys/uio.h>
# undef _KERNEL
#else
@ -33,14 +27,12 @@ struct file;
# endif
#endif
#include <sys/time.h>
#if !defined(linux)
# include <sys/protosw.h>
#endif
#include <sys/socket.h>
#if defined(_KERNEL) && (!defined(__SVR4) && !defined(__svr4__))
#if defined(_KERNEL) && !defined(__SVR4)
# include <sys/mbuf.h>
#endif
#if defined(__SVR4) || defined(__svr4__)
#if defined(__SVR4)
# include <sys/filio.h>
# include <sys/byteorder.h>
# ifdef _KERNEL
@ -49,7 +41,7 @@ struct file;
# include <sys/stream.h>
# include <sys/kmem.h>
#endif
#if defined(__FreeBSD_version) && (__FreeBSD_version >= 300000)
#if defined(__FreeBSD_version)
# include <sys/malloc.h>
#endif

View File

@ -25,24 +25,10 @@ struct rtentry;
static void ipf_setifpaddr __P((struct ifnet *, char *));
void init_ifp __P((void));
#if defined(__sgi) && (IRIX < 60500)
static int no_output __P((struct ifnet *, struct mbuf *,
struct sockaddr *));
static int write_output __P((struct ifnet *, struct mbuf *,
struct sockaddr *));
#else
# if TRU64 >= 1885
static int no_output __P((struct ifnet *, struct mbuf *,
struct sockaddr *, struct rtentry *, char *));
static int write_output __P((struct ifnet *, struct mbuf *,
struct sockaddr *, struct rtentry *, char *));
# else
static int no_output __P((struct ifnet *, struct mbuf *,
struct sockaddr *, struct rtentry *));
static int write_output __P((struct ifnet *, struct mbuf *,
struct sockaddr *, struct rtentry *));
# endif
#endif
struct ifaddr {
struct sockaddr_storage ifa_addr;
@ -123,17 +109,8 @@ ipf_forgetifp(softc, ifp)
static int
#if defined(__sgi) && (IRIX < 60500)
no_output(ifp, m, s)
#else
# if TRU64 >= 1885
no_output (ifp, m, s, rt, cp)
char *cp;
# else
no_output(ifp, m, s, rt)
# endif
struct rtentry *rt;
#endif
struct ifnet *ifp;
struct mbuf *m;
struct sockaddr *s;
@ -143,17 +120,8 @@ no_output(ifp, m, s, rt)
static int
#if defined(__sgi) && (IRIX < 60500)
write_output(ifp, m, s)
#else
# if TRU64 >= 1885
write_output (ifp, m, s, rt, cp)
char *cp;
# else
write_output(ifp, m, s, rt)
# endif
struct rtentry *rt;
#endif
struct ifnet *ifp;
struct mbuf *m;
struct sockaddr *s;
@ -167,8 +135,7 @@ write_output(ifp, m, s, rt)
ip = MTOD(mb, ip_t *);
#if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199606)) || \
(defined(OpenBSD) && (OpenBSD >= 199603)) || defined(linux) || \
(defined(__FreeBSD__) && (__FreeBSD_version >= 501113))
defined(__FreeBSD__)
sprintf(fname, "/tmp/%s", ifp->if_xname);
#else
sprintf(fname, "/tmp/%s%d", ifp->if_name, ifp->if_unit);
@ -189,42 +156,26 @@ ipf_setifpaddr(ifp, addr)
struct ifnet *ifp;
char *addr;
{
#ifdef __sgi
struct in_ifaddr *ifa;
#else
struct ifaddr *ifa;
#endif
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
#if defined(__NetBSD__) || defined(__FreeBSD__)
if (ifp->if_addrlist.tqh_first != NULL)
#else
# ifdef __sgi
if (ifp->in_ifaddr != NULL)
# else
if (ifp->if_addrlist != NULL)
# endif
#endif
return;
ifa = (struct ifaddr *)malloc(sizeof(*ifa));
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
#if defined(__NetBSD__) || defined(__FreeBSD__)
ifp->if_addrlist.tqh_first = ifa;
#else
# ifdef __sgi
ifp->in_ifaddr = ifa;
# else
ifp->if_addrlist = ifa;
# endif
#endif
if (ifa != NULL) {
struct sockaddr_in *sin;
#ifdef __sgi
sin = (struct sockaddr_in *)&ifa->ia_addr;
#else
sin = (struct sockaddr_in *)&ifa->ifa_addr;
#endif
#ifdef USE_INET6
if (index(addr, ':') != NULL) {
struct sockaddr_in6 *sin6;
@ -263,8 +214,7 @@ get_unit(name, family)
struct ifnet *ifp, **ifpp, **old_ifneta;
char *addr;
#if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199606)) || \
(defined(OpenBSD) && (OpenBSD >= 199603)) || defined(linux) || \
(defined(__FreeBSD__) && (__FreeBSD_version >= 501113))
defined(__FreeBSD__)
if (!*name)
return NULL;
@ -333,12 +283,11 @@ get_unit(name, family)
}
ifp = ifneta[nifs - 1];
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
#if defined(__NetBSD__) || defined(__FreeBSD__)
TAILQ_INIT(&ifp->if_addrlist);
#endif
#if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199606)) || \
(defined(OpenBSD) && (OpenBSD >= 199603)) || defined(linux) || \
(defined(__FreeBSD__) && (__FreeBSD_version >= 501113))
defined(__FreeBSD__)
(void) strncpy(ifp->if_xname, name, sizeof(ifp->if_xname));
#else
s = name + strlen(name) - 1;
@ -375,8 +324,7 @@ get_ifname(ifp)
{
static char ifname[LIFNAMSIZ];
#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(linux) || \
(defined(__FreeBSD__) && (__FreeBSD_version >= 501113))
#if defined(__NetBSD__) || defined(__FreeBSD__)
sprintf(ifname, "%s", ifp->if_xname);
#else
if (ifp->if_unit != -1)
@ -397,8 +345,7 @@ init_ifp()
int fd;
#if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199606)) || \
(defined(OpenBSD) && (OpenBSD >= 199603)) || defined(linux) || \
(defined(__FreeBSD__) && (__FreeBSD_version >= 501113))
defined(__FreeBSD__)
for (ifpp = ifneta; ifpp && (ifp = *ifpp); ifpp++) {
ifp->if_output = (void *)write_output;
sprintf(fname, "/tmp/%s", ifp->if_xname);
@ -717,20 +664,12 @@ ipf_ifpaddr(softc, v, atype, ifptr, inp, inpmask)
i6addr_t *inp, *inpmask;
{
struct ifnet *ifp = ifptr;
#ifdef __sgi
struct in_ifaddr *ifa;
#else
struct ifaddr *ifa;
#endif
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
#if defined(__NetBSD__) || defined(__FreeBSD__)
ifa = ifp->if_addrlist.tqh_first;
#else
# ifdef __sgi
ifa = (struct in_ifaddr *)ifp->in_ifaddr;
# else
ifa = ifp->if_addrlist;
# endif
#endif
if (ifa != NULL) {
if (v == 4) {
@ -738,11 +677,7 @@ ipf_ifpaddr(softc, v, atype, ifptr, inp, inpmask)
mask.sin_addr.s_addr = 0xffffffff;
#ifdef __sgi
sin = (struct sockaddr_in *)&ifa->ia_addr;
#else
sin = (struct sockaddr_in *)&ifa->ifa_addr;
#endif
return ipf_ifpfillv4addr(atype, sin, &mask,
&inp->in4, &inpmask->in4);

View File

@ -9,15 +9,12 @@
# define KERNEL 1
# define _KERNEL 1
#endif
#if defined(__osf__)
# define _PROTO_NET_H_
#endif
#include <sys/param.h>
#include <sys/errno.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/file.h>
#if __FreeBSD_version >= 220000 && defined(_KERNEL)
#if defined(__FreeBSD_version) && defined(_KERNEL)
# include <sys/fcntl.h>
# include <sys/filio.h>
#else
@ -26,17 +23,10 @@
#if !defined(_KERNEL)
# include <string.h>
# define _KERNEL
# ifdef __OpenBSD__
struct file;
# endif
# include <sys/uio.h>
# undef _KERNEL
#endif
#include <sys/socket.h>
#if (defined(__osf__) || defined(AIX) || defined(__hpux) || defined(__sgi)) && defined(_KERNEL)
# include "radix_ipf_local.h"
# define _RADIX_H_
#endif
#include <net/if.h>
#if defined(__FreeBSD__)
# include <sys/cdefs.h>
@ -44,7 +34,7 @@ struct file;
#endif
#if defined(_KERNEL)
# include <sys/systm.h>
# if !defined(__SVR4) && !defined(__svr4__)
# if !defined(__SVR4)
# include <sys/mbuf.h>
# endif
#endif
@ -348,9 +338,6 @@ typedef struct fr_info_4_1_32 {
void *fin_qpi;
char fin_ifname[LIFNAMSIZ];
#endif
#ifdef __sgi
void *fin_hbuf;
#endif
} fr_info_4_1_32_t;
typedef struct fr_info_4_1_24 {
@ -389,9 +376,6 @@ typedef struct fr_info_4_1_24 {
void *fin_qpi;
char fin_ifname[LIFNAMSIZ];
#endif
#ifdef __sgi
void *fin_hbuf;
#endif
} fr_info_4_1_24_t;
typedef struct fr_info_4_1_23 {
@ -429,9 +413,6 @@ typedef struct fr_info_4_1_23 {
void *fin_qpi;
char fin_ifname[LIFNAMSIZ];
#endif
#ifdef __sgi
void *fin_hbuf;
#endif
} fr_info_4_1_23_t;
typedef struct fr_info_4_1_11 {
@ -468,9 +449,6 @@ typedef struct fr_info_4_1_11 {
void *fin_qpi;
char fin_ifname[LIFNAMSIZ];
#endif
#ifdef __sgi
void *fin_hbuf;
#endif
} fr_info_4_1_11_t;
/* ------------------------------------------------------------------------ */
@ -2678,9 +2656,6 @@ fr_info_4_1_32_to_current(old, current)
fin->fin_qfm = old->fin_qfm;
fin->fin_qpi = old->fin_qpi;
#endif
#ifdef __sgi
fin->fin_hbuf = old->fin_hbuf;
#endif
}
@ -2719,9 +2694,6 @@ fr_info_4_1_24_to_current(old, current)
fin->fin_qfm = old->fin_qfm;
fin->fin_qpi = old->fin_qpi;
#endif
#ifdef __sgi
fin->fin_hbuf = old->fin_hbuf;
#endif
}
@ -2759,9 +2731,6 @@ fr_info_4_1_23_to_current(old, current)
fin->fin_qfm = old->fin_qfm;
fin->fin_qpi = old->fin_qpi;
#endif
#ifdef __sgi
fin->fin_hbuf = fin->fin_hbuf;
#endif
}
@ -2799,9 +2768,6 @@ fr_info_4_1_11_to_current(old, current)
fin->fin_qfm = old->fin_qfm;
fin->fin_qpi = old->fin_qpi;
#endif
#ifdef __sgi
fin->fin_hbuf = fin->fin_hbuf;
#endif
}
@ -4078,9 +4044,6 @@ fr_info_current_to_4_1_24(current, old)
old->fin_qpi = fin->fin_qpi;
old->fin_ifname[0] = '\0';
#endif
#ifdef __sgi
old->fin_hbuf = fin->fin_hbuf;
#endif
}
@ -4121,9 +4084,6 @@ fr_info_current_to_4_1_23(current, old)
old->fin_qpi = fin->fin_qpi;
old->fin_ifname[0] = '\0';
#endif
#ifdef __sgi
old->fin_hbuf = fin->fin_hbuf;
#endif
}
@ -4164,9 +4124,6 @@ fr_info_current_to_4_1_11(current, old)
old->fin_qpi = fin->fin_qpi;
old->fin_ifname[0] = '\0';
#endif
#ifdef __sgi
old->fin_hbuf = fin->fin_hbuf;
#endif
}

View File

@ -12,11 +12,6 @@
#ifndef __IPF_H__
#define __IPF_H__
#if defined(__osf__)
# define radix_mask ipf_radix_mask
# define radix_node ipf_radix_node
# define radix_node_head ipf_radix_node_head
#endif
#include <sys/param.h>
#include <sys/types.h>
@ -31,9 +26,6 @@
# define _KERNEL
# define KERNEL
#endif
#ifdef __OpenBSD__
struct file;
#endif
#include <sys/uio.h>
#ifdef ADD_KERNEL
# undef _KERNEL
@ -188,9 +180,8 @@ typedef struct proxyrule {
} proxyrule_t;
#if defined(__NetBSD__) || defined(__OpenBSD__) || \
(_BSDI_VERSION >= 199701) || (__FreeBSD_version >= 300000) || \
SOLARIS || defined(__sgi) || defined(__osf__) || defined(linux)
#if defined(__NetBSD__) || defined(__FreeBSD_version) || \
SOLARIS
# include <stdarg.h>
typedef int (* ioctlfunc_t) __P((int, ioctlcmd_t, ...));
#else
@ -200,13 +191,6 @@ typedef int (* addfunc_t) __P((int, ioctlfunc_t, void *));
typedef int (* copyfunc_t) __P((void *, void *, size_t));
/*
* SunOS4
*/
#if defined(sun) && !defined(__SVR4) && !defined(__svr4__)
extern int ioctl __P((int, int, void *));
#endif
extern char thishost[];
extern char flagset[];
extern u_char flags[];

View File

@ -112,130 +112,12 @@
# define IPOPT_SECUR_TOPSECRET ((u_short)0x6bc5)
#endif
#ifdef linux
# if LINUX < 0200
# define icmp icmphdr
# define icmp_type type
# define icmp_code code
# endif
/*
* From /usr/include/netinet/ip_var.h
* !%@#!$@# linux...
*/
struct ipovly {
caddr_t ih_next, ih_prev; /* for protocol sequence q's */
u_char ih_x1; /* (unused) */
u_char ih_pr; /* protocol */
short ih_len; /* protocol length */
struct in_addr ih_src; /* source internet address */
struct in_addr ih_dst; /* destination internet address */
};
typedef struct {
__u16 th_sport;
__u16 th_dport;
__u32 th_seq;
__u32 th_ack;
# if defined(__i386__) || defined(__MIPSEL__) || defined(__alpha__) ||\
defined(vax)
__u8 th_res:4;
__u8 th_off:4;
#else
__u8 th_off:4;
__u8 th_res:4;
#endif
__u8 th_flags;
__u16 th_win;
__u16 th_sum;
__u16 th_urp;
} tcphdr_t;
typedef struct {
__u16 uh_sport;
__u16 uh_dport;
__s16 uh_ulen;
__u16 uh_sum;
} udphdr_t;
typedef struct {
# if defined(__i386__) || defined(__MIPSEL__) || defined(__alpha__) ||\
defined(vax)
__u8 ip_hl:4;
__u8 ip_v:4;
# else
__u8 ip_hl:4;
__u8 ip_v:4;
# endif
__u8 ip_tos;
__u16 ip_len;
__u16 ip_id;
__u16 ip_off;
__u8 ip_ttl;
__u8 ip_p;
__u16 ip_sum;
struct in_addr ip_src;
struct in_addr ip_dst;
} ip_t;
typedef struct {
__u8 ether_dhost[6];
__u8 ether_shost[6];
__u16 ether_type;
} ether_header_t;
typedef struct icmp {
u_char icmp_type; /* type of message, see below */
u_char icmp_code; /* type sub code */
u_short icmp_cksum; /* ones complement cksum of struct */
union {
u_char ih_pptr; /* ICMP_PARAMPROB */
struct in_addr ih_gwaddr; /* ICMP_REDIRECT */
struct ih_idseq {
n_short icd_id;
n_short icd_seq;
} ih_idseq;
int ih_void;
} icmp_hun;
#define icmp_pptr icmp_hun.ih_pptr
#define icmp_gwaddr icmp_hun.ih_gwaddr
#define icmp_id icmp_hun.ih_idseq.icd_id
#define icmp_seq icmp_hun.ih_idseq.icd_seq
#define icmp_void icmp_hun.ih_void
union {
struct id_ts {
n_time its_otime;
n_time its_rtime;
n_time its_ttime;
} id_ts;
struct id_ip {
ip_t idi_ip;
/* options and then 64 bits of data */
} id_ip;
u_long id_mask;
char id_data[1];
} icmp_dun;
#define icmp_otime icmp_dun.id_ts.its_otime
#define icmp_rtime icmp_dun.id_ts.its_rtime
#define icmp_ttime icmp_dun.id_ts.its_ttime
#define icmp_ip icmp_dun.id_ip.idi_ip
#define icmp_mask icmp_dun.id_mask
#define icmp_data icmp_dun.id_data
} icmphdr_t;
# define bcopy(a,b,c) memmove(b,a,c)
# define bcmp(a,b,c) memcmp(a,b,c)
# define ifnet device
#else
typedef struct udphdr udphdr_t;
typedef struct tcphdr tcphdr_t;
typedef struct ip ip_t;
typedef struct ether_header ether_header_t;
#endif
#if defined(__SVR4) || defined(__svr4__)
# define bcopy(a,b,c) memmove(b,a,c)

View File

@ -10,9 +10,7 @@
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_types.h>
#ifndef __osf__
# include <net/route.h>
#endif
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <arpa/inet.h>

View File

@ -88,7 +88,6 @@ int arp(ip, ether)
sin = (struct sockaddr_in *)&ar.arp_pa;
sin->sin_family = AF_INET;
bcopy(ip, (char *)&sin->sin_addr.s_addr, 4);
#ifndef hpux
if ((hp = gethostbyaddr(ip, 4, AF_INET)))
# if SOLARIS && (SOLARIS2 >= 10)
if (!(ether_hostton(hp->h_name, (struct ether_addr *)ether)))
@ -96,7 +95,6 @@ int arp(ip, ether)
if (!(ether_hostton(hp->h_name, ether)))
# endif
goto savearp;
#endif
if (sfd == -1)
if ((sfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1)

View File

@ -20,11 +20,7 @@ typedef unsigned long ulong;
#include <sys/types.h>
#include <sys/stream.h>
#include <sys/stropts.h>
#ifdef __osf__
# include <sys/dlpihdr.h>
#else
# include <sys/dlpi.h>
#endif
#include <sys/signal.h>
#include <stdio.h>
#include <string.h>

View File

@ -17,11 +17,9 @@ static const char rcsid[] = "@(#)$Id$";
#include <netinet/in.h>
#include <netinet/ip.h>
#include <sys/param.h>
#ifndef linux
# include <net/route.h>
# include <netinet/if_ether.h>
# include <netinet/ip_var.h>
#endif
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -18,9 +18,7 @@ static const char rcsid[] = "@(#)$Id$";
#include <arpa/inet.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#ifndef linux
#include <netinet/ip_var.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -37,9 +35,6 @@ extern struct ipread pcap, iphex, iptext;
int opts = 0;
#ifndef DEFAULT_DEVICE
# ifdef linux
char default_device[] = "eth0";
# else
# ifdef sun
char default_device[] = "le0";
# else
@ -49,15 +44,10 @@ char default_device[] = "ln0";
# ifdef __bsdi__
char default_device[] = "ef0";
# else
# ifdef __sgi
char default_device[] = "ec0";
# else
char default_device[] = "lan0";
# endif
# endif
# endif
# endif
# endif
#else
char default_device[] = DEFAULT_DEVICE;
#endif

View File

@ -21,14 +21,10 @@ static const char rcsid[] = "@(#)$Id$";
#include <netdb.h>
#include <string.h>
#include <netinet/ip.h>
#ifndef linux
# include <netinet/ip_var.h>
#endif
#include "ipsend.h"
#include "ipf.h"
#ifndef linux
# include <netinet/udp_var.h>
#endif
extern char *optarg;
@ -37,27 +33,15 @@ extern void iplang __P((FILE *));
char options[68];
int opts;
#ifdef linux
char default_device[] = "eth0";
#else
# ifdef ultrix
char default_device[] = "ln0";
# else
# ifdef __bsdi__
char default_device[] = "ef0";
# else
# ifdef __sgi
char default_device[] = "ec0";
# else
# ifdef __hpux
char default_device[] = "lan0";
# else
char default_device[] = "le0";
# endif /* __hpux */
# endif /* __sgi */
# endif /* __bsdi__ */
# endif /* ultrix */
#endif /* linux */
static void usage __P((char *));

View File

@ -26,9 +26,6 @@
#include <net/if.h>
#include "ipf.h"
#ifdef linux
#include <linux/sockios.h>
#endif
/* XXX: The following is needed by tcpip.h */
#include <netinet/ip_var.h>
#include "netinet/tcpip.h"
@ -49,11 +46,7 @@ extern u_32_t buildopts __P((char *, char *, int));
extern int addipopt __P((char *, struct ipopt_names *, int, char *));
extern int initdevice __P((char *, int));
extern int sendip __P((int, char *, int));
#ifdef linux
extern struct sock *find_tcp __P((int, struct tcpiphdr *));
#else
extern struct tcpcb *find_tcp __P((int, struct tcpiphdr *));
#endif
extern int ip_resend __P((char *, int, struct ipread *, struct in_addr, char *));
extern void ip_test1 __P((char *, int, ip_t *, struct in_addr, int));

View File

@ -20,9 +20,7 @@ static const char rcsid[] = "@(#)$Id$";
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#ifndef linux
#include <netinet/ip_var.h>
#endif
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include "ipsend.h"

View File

@ -18,12 +18,7 @@ static const char rcsid[] = "@(#)$Id$";
#include <arpa/inet.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#ifndef linux
#include <netinet/ip_var.h>
#endif
#ifdef linux
#include <linux/sockios.h>
#endif
#include <stdio.h>
#include <netdb.h>
#include <unistd.h>
@ -36,9 +31,6 @@ extern char *optarg;
extern int optind;
char options[68];
#ifdef linux
char default_device[] = "eth0";
#else
# ifdef sun
char default_device[] = "le0";
# else
@ -48,15 +40,10 @@ char default_device[] = "ln0";
# ifdef __bsdi__
char default_device[] = "ef0";
# else
# ifdef __sgi
char default_device[] = "ec0";
# else
char default_device[] = "lan0";
# endif
# endif
# endif
# endif
#endif
static void usage __P((char *));
int main __P((int, char **));

View File

@ -21,7 +21,6 @@ static const char rcsid[] = "@(#)$Id$";
typedef int boolean_t;
#endif
#include <sys/time.h>
#if !defined(__osf__)
# ifdef __NetBSD__
# include <machine/lock.h>
# include <machine/mutex.h>
@ -37,7 +36,6 @@ typedef int boolean_t;
# endif
# undef _KERNEL
# undef KERNEL
#endif
#if !defined(solaris) && !defined(linux) && !defined(__sgi)
# include <nlist.h>
# include <sys/user.h>
@ -66,24 +64,13 @@ typedef int boolean_t;
#endif
#include <netinet/in_systm.h>
#include <sys/socket.h>
#ifdef __hpux
# define _NET_ROUTE_INCLUDED
#endif
#include <net/if.h>
#if defined(linux) && (LINUX >= 0200)
# include <asm/atomic.h>
#endif
#if !defined(linux)
# if defined(__FreeBSD__)
# include "radix_ipf.h"
# endif
# if !defined(solaris)
# include <net/route.h>
# endif
#else
# define __KERNEL__ /* because there's a macro not wrapped by this */
# include <net/route.h> /* in this file :-/ */
#endif
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netinet/ip.h>
@ -94,20 +81,13 @@ typedef int boolean_t;
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#ifdef __hpux
# undef _NET_ROUTE_INCLUDED
#endif
#if !defined(linux)
# include <netinet/ip_var.h>
# if !defined(__hpux) && !defined(solaris)
# include <netinet/in_pcb.h>
# endif
#endif
#include "ipsend.h"
#if !defined(linux) && !defined(__hpux)
# include <netinet/tcp_timer.h>
# include <netinet/tcp_var.h>
#endif
#if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106000000)
# define USE_NANOSLEEP
#endif
@ -951,9 +931,7 @@ void ip_test5(dev, mtu, ip, gwip, ptest)
int nfd, i;
t = (tcphdr_t *)((char *)ip + (IP_HL(ip) << 2));
#if !defined(linux) && !defined(__osf__)
t->th_x2 = 0;
#endif
TCP_OFF_A(t, 0);
t->th_sport = htons(1);
t->th_dport = htons(1);

View File

@ -19,10 +19,8 @@ static const char rcsid[] = "@(#)$Id$";
#include <arpa/inet.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#ifndef linux
# include <netinet/ip_var.h>
# include <netinet/if_ether.h>
#endif
#include <stdio.h>
#include <netdb.h>
#include <string.h>

View File

@ -25,14 +25,7 @@
# include <sys/pfmod.h>
# include <sys/bufmod.h>
#endif
#ifdef __osf__
# include <sys/dlpihdr.h>
#else
# include <sys/dlpi.h>
#endif
#ifdef __hpux
# include <sys/dlpi_ext.h>
#endif
#include <net/if.h>
#include <netinet/in.h>

View File

@ -29,7 +29,6 @@ typedef int boolean_t;
#else
# include <sys/dir.h>
#endif
#if !defined(__osf__)
# ifdef __NetBSD__
# include <machine/lock.h>
# endif
@ -50,7 +49,6 @@ typedef int boolean_t;
# undef _KERNEL
# undef KERNEL
# endif
#endif
#include <nlist.h>
#include <sys/user.h>
#include <sys/socket.h>
@ -74,9 +72,7 @@ typedef int boolean_t;
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <net/if.h>
#ifndef __osf__
# include <net/route.h>
#endif
#include <netinet/ip_var.h>
#define _WANT_INPCB
#include <netinet/in_pcb.h>

View File

@ -25,9 +25,6 @@ char *getifname(ptr)
# include <sys/mutex.h>
# include <sys/condvar.h>
# endif
# ifdef __hpux
# include "compat.h"
# endif
# include "../pfil/qif.h"
char *ifname;
qif_t qif;

View File

@ -23,14 +23,6 @@ int getproto(name)
if (*s == '\0')
return atoi(name);
#ifdef _AIX51
/*
* For some bogus reason, "ip" is 252 in /etc/protocols on AIX 5
* The IANA has doubled up on the definition of 0 - it is now also
* used for IPv6 hop-opts, so we can no longer rely on /etc/protocols
* providing the correct name->number mapping
*/
#endif
if (!strcasecmp(name, "ip"))
return 0;

View File

@ -72,7 +72,6 @@ static const char rcsid[] = "@(#)$Id: inet_addr.c,v 1.8.2.3 2004/12/09 19:41:20
# define __P(x) ()
# endif
#endif
#ifndef linux
int inet_aton __P((const char *, struct in_addr *));
/*
@ -189,7 +188,6 @@ inet_aton(cp, addr)
addr->s_addr = htonl(val);
return (1);
}
#endif
/* these are compatibility routines, not needed on recent BSD releases */

View File

@ -18,9 +18,7 @@
#include <string.h>
#include <fcntl.h>
#include <sys/file.h>
#if !defined(__sgi) && !defined(__hpux) && !defined(__osf__) && !defined(linux) && !defined(_AIX51)
#include <kvm.h>
#endif
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
@ -29,9 +27,6 @@
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <net/if.h>
#if defined(linux) || defined(__osf__) || defined(__sgi) || defined(__hpux)
# include <stdlib.h>
#endif
#include "kmem.h"
@ -46,82 +41,8 @@ static const char rcsid[] = "@(#)$Id$";
#if !defined(__sgi) && !defined(__hpux) && !defined(__osf__) && \
!defined(linux) && !defined(_AIX51)
/*
* For all platforms where there is a libkvm and a kvm_t, we use that...
*/
static kvm_t *kvm_f = NULL;
#else
/*
*...and for the others (HP-UX, IRIX, Tru64), we have to provide our own.
*/
typedef int * kvm_t;
static kvm_t kvm_f = NULL;
static char *kvm_errstr = NULL;
kvm_t kvm_open __P((char *, char *, char *, int, char *));
int kvm_read __P((kvm_t, u_long, char *, size_t));
kvm_t kvm_open(kernel, core, swap, mode, errstr)
char *kernel, *core, *swap;
int mode;
char *errstr;
{
kvm_t k;
int fd;
kvm_errstr = errstr;
if (core == NULL)
core = "/dev/kmem";
fd = open(core, mode);
if (fd == -1)
return NULL;
k = malloc(sizeof(*k));
if (k == NULL)
return NULL;
*k = fd;
return k;
}
int kvm_read(kvm, pos, buffer, size)
kvm_t kvm;
u_long pos;
char *buffer;
size_t size;
{
int r = 0, left;
char *bufp;
if (lseek(*kvm, pos, 0) == -1) {
if (kvm_errstr != NULL) {
fprintf(stderr, "%s", kvm_errstr);
perror("lseek");
}
return -1;
}
for (bufp = buffer, left = size; left > 0; bufp += r, left -= r) {
r = read(*kvm, bufp, left);
#ifdef __osf__
/*
* Tru64 returns "0" for successful operation, not the number
* of bytes read.
*/
if (r == 0)
r = left;
#endif
if (r <= 0)
return -1;
}
return r;
}
#endif /* !defined(__sgi) && !defined(__hpux) && !defined(__osf__) */
int openkmem(kern, core)
char *kern, *core;

View File

@ -27,14 +27,6 @@ printproto(pr, p, np)
PRINTF("udp");
else if (np->in_flags & IPN_ICMPQUERY)
PRINTF("icmp");
#ifdef _AIX51
/*
* To make up for "ip = 252" and "hopopt = 0" in /etc/protocols
* The IANA has doubled up on the definition of 0 - it is now
* also used for IPv6 hop-opts, so we can no longer rely on
* /etc/protocols providing the correct name->number mapping.
*/
#endif
else if (np->in_pr[0] == 0)
PRINTF("ip");
else if (pr != NULL)
@ -42,11 +34,6 @@ printproto(pr, p, np)
else
PRINTF("%d", np->in_pr[0]);
} else {
#ifdef _AIX51
if (p == 0)
PRINTF("ip");
else
#endif
if (pr != NULL)
PRINTF("%s", pr->p_name);
else

View File

@ -35,16 +35,11 @@
***********************************************************************
*/
#if defined(linux) && defined(_KERNEL)
extern void *memcpy(void *, const void *, unsigned long);
# define bcopy(a,b,c) memcpy(b,a,c)
#else
# if defined(_KERNEL) && !defined(__sgi)
# if defined(_KERNEL)
# include <sys/systm.h>
# else
# include <string.h>
# endif
#endif
#include "md5.h"

View File

@ -5,15 +5,6 @@
*
* See the IPFILTER.LICENCE file for details on licencing.
*/
#ifdef __FreeBSD__
# ifndef __FreeBSD_cc_version
# include <osreldate.h>
# else
# if __FreeBSD_cc_version < 430000
# include <osreldate.h>
# endif
# endif
#endif
#include "ipf.h"
#include <fcntl.h>
#include <ctype.h>

View File

@ -5,15 +5,6 @@
*
* See the IPFILTER.LICENCE file for details on licencing.
*/
#ifdef __FreeBSD__
# ifndef __FreeBSD_cc_version
# include <osreldate.h>
# else
# if __FreeBSD_cc_version < 430000
# include <osreldate.h>
# endif
# endif
#endif
#include <stdio.h>
#include <unistd.h>
#include <string.h>

View File

@ -5,58 +5,26 @@
*
* See the IPFILTER.LICENCE file for details on licencing.
*/
#ifdef __FreeBSD__
# ifndef __FreeBSD_cc_version
# include <osreldate.h>
# else
# if __FreeBSD_cc_version < 430000
# include <osreldate.h>
# endif
# endif
#endif
#include <sys/ioctl.h>
#include <ctype.h>
#include <fcntl.h>
#ifdef linux
# include <linux/a.out.h>
#else
# include <nlist.h>
#endif
#include <ctype.h>
#if defined(sun) && (defined(__svr4__) || defined(__SVR4))
#if defined(sun) && defined(__SVR4)
# include <stddef.h>
#endif
#include "ipf.h"
#include "netinet/ipl.h"
#if defined(STATETOP)
# if defined(_BSDI_VERSION)
# undef STATETOP
# endif
# if defined(__FreeBSD__) && \
(!defined(__FreeBSD_version) || (__FreeBSD_version < 430000))
# undef STATETOP
# endif
# if defined(__NetBSD_Version__) && (__NetBSD_Version__ < 105000000)
# undef STATETOP
# endif
# if defined(sun)
# if defined(__svr4__) || defined(__SVR4)
#if defined(STATETOP)
# if defined(sun) && defined(__SVR4)
# include <sys/select.h>
# else
# undef STATETOP /* NOT supported on SunOS4 */
# endif
# endif
#endif
#if defined(STATETOP) && !defined(linux)
# include <netinet/ip_var.h>
# include <netinet/tcp_fsm.h>
#endif
#ifdef STATETOP
# include <ctype.h>
# include <signal.h>
# include <time.h>
# if SOLARIS || defined(__NetBSD__) || defined(_BSDI_VERSION) || \
defined(__sgi)
# if SOLARIS || defined(__NetBSD__)
# ifdef ERR
# undef ERR
# endif
@ -66,7 +34,7 @@
# endif /* SOLARIS */
#endif /* STATETOP */
#include "kmem.h"
#if defined(__NetBSD__) || (__OpenBSD__)
#if defined(__NetBSD__)
# include <paths.h>
#endif
@ -75,9 +43,6 @@ static const char sccsid[] = "@(#)fils.c 1.21 4/20/96 (C) 1993-2000 Darren Reed"
static const char rcsid[] = "@(#)$Id$";
#endif
#ifdef __hpux
# define nlist nlist64
#endif
extern char *optarg;
extern int optind;

View File

@ -43,9 +43,6 @@ void dumprules __P((frentry_t *));
void drain_log __P((char *));
void fixv4sums __P((mb_t *, ip_t *));
#if defined(__NetBSD__) || defined(__OpenBSD__) || SOLARIS || \
(_BSDI_VERSION >= 199701) || (__FreeBSD_version >= 300000) || \
defined(__osf__) || defined(linux)
int ipftestioctl __P((int, ioctlcmd_t, ...));
int ipnattestioctl __P((int, ioctlcmd_t, ...));
int ipstatetestioctl __P((int, ioctlcmd_t, ...));
@ -53,15 +50,6 @@ int ipauthtestioctl __P((int, ioctlcmd_t, ...));
int ipscantestioctl __P((int, ioctlcmd_t, ...));
int ipsynctestioctl __P((int, ioctlcmd_t, ...));
int ipooltestioctl __P((int, ioctlcmd_t, ...));
#else
int ipftestioctl __P((dev_t, ioctlcmd_t, void *));
int ipnattestioctl __P((dev_t, ioctlcmd_t, void *));
int ipstatetestioctl __P((dev_t, ioctlcmd_t, void *));
int ipauthtestioctl __P((dev_t, ioctlcmd_t, void *));
int ipsynctestioctl __P((dev_t, ioctlcmd_t, void *));
int ipscantestioctl __P((dev_t, ioctlcmd_t, void *));
int ipooltestioctl __P((dev_t, ioctlcmd_t, void *));
#endif
static ioctlfunc_t iocfunctions[IPL_LOGSIZE] = { ipftestioctl,
ipnattestioctl,
@ -292,15 +280,7 @@ main(argc,argv)
ipf_state_flush(softc, 1, 0);
if (dir && (ifp != NULL) && IP_V(ip) && (m != NULL))
#if defined(__sgi) && (IRIX < 60500)
(*ifp->if_output)(ifp, (void *)m, NULL);
#else
# if TRU64 >= 1885
(*ifp->if_output)(ifp, (void *)m, NULL, 0, 0);
# else
(*ifp->if_output)(ifp, (void *)m, NULL, 0);
# endif
#endif
while ((m != NULL) && (m != &mb)) {
n = m->mb_next;
@ -351,9 +331,6 @@ main(argc,argv)
}
#if defined(__NetBSD__) || defined(__OpenBSD__) || SOLARIS || \
(_BSDI_VERSION >= 199701) || (__FreeBSD_version >= 300000) || \
defined(__osf__) || defined(linux)
int ipftestioctl(int dev, ioctlcmd_t cmd, ...)
{
caddr_t data;
@ -513,141 +490,6 @@ int ipooltestioctl(int dev, ioctlcmd_t cmd, ...)
}
return 0;
}
#else
int ipftestioctl(dev, cmd, data)
dev_t dev;
ioctlcmd_t cmd;
void *data;
{
int i;
dev = dev; /* gcc -Wextra */
i = ipfioctl(softc, IPL_LOGIPF, cmd, data, FWRITE|FREAD);
if ((opts & OPT_DEBUG) || (i != 0))
fprintf(stderr, "ipfioctl(IPF,%#x,%p) = %d (%d)\n",
cmd, data, i, softc->ipf_interror);
if (i != 0) {
errno = i;
return -1;
}
return 0;
}
int ipnattestioctl(dev, cmd, data)
dev_t dev;
ioctlcmd_t cmd;
void *data;
{
int i;
dev = dev; /* gcc -Wextra */
i = ipfioctl(softc, IPL_LOGNAT, cmd, data, FWRITE|FREAD);
if ((opts & OPT_DEBUG) || (i != 0))
fprintf(stderr, "ipfioctl(NAT,%#x,%p) = %d\n", cmd, data, i);
if (i != 0) {
errno = i;
return -1;
}
return 0;
}
int ipstatetestioctl(dev, cmd, data)
dev_t dev;
ioctlcmd_t cmd;
void *data;
{
int i;
dev = dev; /* gcc -Wextra */
i = ipfioctl(softc, IPL_LOGSTATE, cmd, data, FWRITE|FREAD);
if ((opts & OPT_DEBUG) || (i != 0))
fprintf(stderr, "ipfioctl(STATE,%#x,%p) = %d\n", cmd, data, i);
if (i != 0) {
errno = i;
return -1;
}
return 0;
}
int ipauthtestioctl(dev, cmd, data)
dev_t dev;
ioctlcmd_t cmd;
void *data;
{
int i;
dev = dev; /* gcc -Wextra */
i = ipfioctl(softc, IPL_LOGAUTH, cmd, data, FWRITE|FREAD);
if ((opts & OPT_DEBUG) || (i != 0))
fprintf(stderr, "ipfioctl(AUTH,%#x,%p) = %d\n", cmd, data, i);
if (i != 0) {
errno = i;
return -1;
}
return 0;
}
int ipsynctestioctl(dev, cmd, data)
dev_t dev;
ioctlcmd_t cmd;
void *data;
{
int i;
dev = dev; /* gcc -Wextra */
i = ipfioctl(softc, IPL_LOGSYNC, cmd, data, FWRITE|FREAD);
if ((opts & OPT_DEBUG) || (i != 0))
fprintf(stderr, "ipfioctl(SYNC,%#x,%p) = %d\n", cmd, data, i);
if (i != 0) {
errno = i;
return -1;
}
return 0;
}
int ipscantestioctl(dev, cmd, data)
dev_t dev;
ioctlcmd_t cmd;
void *data;
{
int i;
dev = dev; /* gcc -Wextra */
i = ipfioctl(softc, IPL_LOGSCAN, cmd, data, FWRITE|FREAD);
if ((opts & OPT_DEBUG) || (i != 0))
fprintf(stderr, "ipfioctl(SCAN,%#x,%p) = %d\n", cmd, data, i);
if (i != 0) {
errno = i;
return -1;
}
return 0;
}
int ipooltestioctl(dev, cmd, data)
dev_t dev;
ioctlcmd_t cmd;
void *data;
{
int i;
dev = dev; /* gcc -Wextra */
i = ipfioctl(softc, IPL_LOGLOOKUP, cmd, data, FWRITE|FREAD);
if (opts & OPT_DEBUG)
fprintf(stderr, "ipfioctl(POOL,%#x,%p) = %d (%d)\n",
cmd, data, i, softc->ipf_interror);
if (i != 0) {
errno = i;
return -1;
}
return 0;
}
#endif
int kmemcpy(addr, offset, size)

View File

@ -20,12 +20,7 @@ static const char rcsid[] = "@(#)$Id$";
#endif
#if defined(sun) && !defined(SOLARIS2)
#define STRERROR(x) sys_errlist[x]
extern char *sys_errlist[];
#else
#define STRERROR(x) strerror(x)
#endif
extern int optind;
extern char *optarg;
@ -116,11 +111,7 @@ char *reasons[] = {
#ifdef MENTAT
static char *pidfile = "/etc/opt/ipf/ipmon.pid";
#else
# if BSD >= 199306
static char *pidfile = "/var/run/ipmon.pid";
# else
static char *pidfile = "/etc/ipmon.pid";
# endif
#endif
static char line[2048];
@ -138,11 +129,7 @@ static char *icmpname __P((u_int, u_int));
static char *icmpname6 __P((u_int, u_int));
static icmp_type_t *find_icmptype __P((int, icmp_type_t *, size_t));
static icmp_subtype_t *find_icmpsubtype __P((int, icmp_subtype_t *, size_t));
#ifdef __hpux
static struct tm *get_tm __P((u_32_t));
#else
static struct tm *get_tm __P((time_t));
#endif
char *portlocalname __P((int, char *, u_int));
int main __P((int, char *[]));
@ -400,11 +387,6 @@ static void init_tabs()
if (protocols[0])
free(protocols[0]);
protocols[0] = strdup("ip");
#if defined(_AIX51)
if (protocols[252])
free(protocols[252]);
protocols[252] = NULL;
#endif
}
if (udp_ports != NULL) {
@ -643,11 +625,7 @@ void dumphex(log, dopts, buf, len)
static struct tm *get_tm(sec)
#ifdef __hpux
u_32_t sec;
#else
time_t sec;
#endif
{
struct tm *tm;
time_t t;
@ -1123,10 +1101,6 @@ static void print_ipflog(conf, buf, blen)
sprintf(t, "%dx ", ipl->ipl_count);
t += strlen(t);
}
#if (defined(MENTAT) || \
(defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199603)) || \
(defined(__FreeBSD__) && (__FreeBSD_version >= 501113)) || \
(defined(OpenBSD) && (OpenBSD >= 199603))) || defined(linux)
{
char ifname[sizeof(ipf->fl_ifname) + 1];
@ -1134,28 +1108,13 @@ static void print_ipflog(conf, buf, blen)
ifname[sizeof(ipf->fl_ifname)] = '\0';
sprintf(t, "%s", ifname);
t += strlen(t);
# if defined(MENTAT) || defined(linux)
# if defined(linux)
/*
* On Linux, the loopback interface is just "lo", not "lo0".
*/
if (strcmp(ifname, "lo") != 0)
# endif
# if defined(MENTAT)
if (ISALPHA(*(t - 1))) {
sprintf(t, "%d", ipf->fl_unit);
t += strlen(t);
}
# endif
}
#else
for (len = 0; len < 3; len++)
if (ipf->fl_ifname[len] == '\0')
break;
if (ipf->fl_ifname[len])
len++;
sprintf(t, "%*.*s%u", len, len, ipf->fl_ifname, ipf->fl_unit);
t += strlen(t);
#endif
if ((ipf->fl_group[0] == (char)~0) && (ipf->fl_group[1] == '\0'))
strcat(t, " @-1:");
else if (ipf->fl_group[0] == '\0')

View File

@ -12,7 +12,7 @@
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#if !defined(__SVR4) && !defined(__svr4__)
#if !defined(__SVR4)
#include <strings.h>
#else
#include <sys/byteorder.h>
@ -28,7 +28,7 @@
#undef _KERNEL
#include <sys/socket.h>
#include <sys/ioctl.h>
#if defined(sun) && (defined(__svr4__) || defined(__SVR4))
#if defined(sun) && defined(__SVR4)
# include <sys/ioccom.h>
# include <sys/sysmacros.h>
#endif
@ -42,25 +42,13 @@
#include <arpa/inet.h>
#include <resolv.h>
#include <ctype.h>
#if defined(linux)
# include <linux/a.out.h>
#else
# include <nlist.h>
#endif
#include "ipf.h"
#include "netinet/ipl.h"
#include "kmem.h"
#ifdef __hpux
# define nlist nlist64
#endif
#if defined(sun) && !SOLARIS2
# define STRERROR(x) sys_errlist[x]
extern char *sys_errlist[];
#else
# define STRERROR(x) strerror(x)
#endif
#if !defined(lint)
static const char sccsid[] ="@(#)ipnat.c 1.9 6/5/96 (C) 1993 Darren Reed";

View File

@ -6,15 +6,6 @@
* See the IPFILTER.LICENCE file for details on licencing.
*/
%{
#ifdef __FreeBSD__
# ifndef __FreeBSD_cc_version
# include <osreldate.h>
# else
# if __FreeBSD_cc_version < 430000
# include <osreldate.h>
# endif
# endif
#endif
#include <stdio.h>
#include <unistd.h>
#include <string.h>

View File

@ -9,9 +9,7 @@
#include <sys/time.h>
#include <sys/param.h>
#include <sys/socket.h>
#if defined(BSD) && (BSD >= 199306)
# include <sys/cdefs.h>
#endif
#include <sys/ioctl.h>
#include <net/if.h>
@ -26,11 +24,7 @@
#include <netdb.h>
#include <ctype.h>
#include <unistd.h>
#ifdef linux
# include <linux/a.out.h>
#else
# include <nlist.h>
#endif
#include "ipf.h"
#include "netinet/ipl.h"

View File

@ -10,9 +10,7 @@
#include <sys/time.h>
#include <sys/param.h>
#include <sys/socket.h>
#if defined(BSD) && (BSD >= 199306)
# include <sys/cdefs.h>
#endif
#include <sys/ioctl.h>
#include <net/if.h>

View File

@ -20,26 +20,18 @@
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
#if defined(_KERNEL) && defined(__FreeBSD_version) && \
(__FreeBSD_version >= 220000)
# if (__FreeBSD_version >= 400000)
#if defined(_KERNEL) && defined(__FreeBSD_version)
# if !defined(IPFILTER_LKM)
# include "opt_inet6.h"
# endif
# if (__FreeBSD_version == 400019)
# define CSUM_DELAY_DATA
# endif
# endif
# include <sys/filio.h>
#else
# include <sys/ioctl.h>
#endif
#if (defined(__SVR4) || defined(__svr4__)) && defined(sun)
#if defined(__SVR4) || defined(sun) /* SOLARIS */
# include <sys/filio.h>
#endif
#if !defined(_AIX51)
# include <sys/fcntl.h>
#endif
#if defined(_KERNEL)
# include <sys/systm.h>
# include <sys/file.h>
@ -50,29 +42,18 @@
# include <stddef.h>
# include <sys/file.h>
# define _KERNEL
# ifdef __OpenBSD__
struct file;
# endif
# include <sys/uio.h>
# undef _KERNEL
#endif
#if !defined(__SVR4) && !defined(__svr4__) && !defined(__hpux) && \
!defined(linux)
#if !defined(__SVR4)
# include <sys/mbuf.h>
#else
# if !defined(linux)
# include <sys/byteorder.h>
# endif
# if (SOLARIS2 < 5) && defined(sun)
# include <sys/dditypes.h>
# endif
#endif
#ifdef __hpux
# define _NET_ROUTE_INCLUDED
#endif
#if !defined(linux)
# include <sys/protosw.h>
#endif
#include <sys/socket.h>
#include <net/if.h>
#ifdef sun
@ -81,25 +62,13 @@ struct file;
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#if defined(__sgi) && defined(IFF_DRVRLOCK) /* IRIX 6 */
# include <sys/hashing.h>
# include <netinet/in_var.h>
#endif
#include <netinet/tcp.h>
#if (!defined(__sgi) && !defined(AIX)) || defined(_KERNEL)
# include <netinet/udp.h>
# include <netinet/ip_icmp.h>
#endif
#ifdef __hpux
# undef _NET_ROUTE_INCLUDED
#endif
#ifdef __osf__
# undef _RADIX_H_
#endif
#include "netinet/ip_compat.h"
#ifdef USE_INET6
# include <netinet/icmp6.h>
# if !SOLARIS && defined(_KERNEL) && !defined(__osf__) && !defined(__hpux)
# if !SOLARIS && defined(_KERNEL)
# include <netinet6/in6_var.h>
# endif
#endif
@ -122,7 +91,7 @@ struct file;
#if defined(IPFILTER_BPF) && defined(_KERNEL)
# include <net/bpf.h>
#endif
#if defined(__FreeBSD_version) && (__FreeBSD_version >= 300000)
#if defined(__FreeBSD_version)
# include <sys/malloc.h>
#endif
#include "netinet/ipl.h"
@ -131,10 +100,6 @@ struct file;
# include <sys/callout.h>
extern struct callout ipf_slowtimer_ch;
#endif
#if defined(__OpenBSD__)
# include <sys/timeout.h>
extern struct timeout ipf_slowtimer_ch;
#endif
/* END OF INCLUDES */
#if !defined(lint)
@ -214,10 +179,7 @@ static int ipf_updateipid __P((fr_info_t *));
static int ipf_settimeout __P((struct ipf_main_softc_s *,
struct ipftuneable *,
ipftuneval_t *));
#if !defined(_KERNEL) || (!defined(__NetBSD__) && !defined(__OpenBSD__) && \
!defined(__FreeBSD__)) || \
FREEBSD_LT_REV(501000) || NETBSD_LT_REV(105000000) || \
OPENBSD_LT_REV(200006)
#if !defined(_KERNEL) || SOLARIS
static int ppsratecheck(struct timeval *, int *, int);
#endif
@ -3267,12 +3229,6 @@ ipf_check(ctx, ip, hlen, ifp, out
}
} else {
LBUMP(ipf_stats[out].fr_pass);
#if defined(_KERNEL) && defined(__sgi)
if ((fin->fin_hbuf != NULL) &&
(mtod(fin->fin_m, struct ip *) != fin->fin_ip)) {
COPYBACK(fin->fin_m, 0, fin->fin_plen, fin->fin_hbuf);
}
#endif
}
SPL_X(s);
@ -5483,10 +5439,7 @@ ipf_resolvefunc(softc, data)
}
#if !defined(_KERNEL) || (!defined(__NetBSD__) && !defined(__OpenBSD__) && \
!defined(__FreeBSD__)) || \
FREEBSD_LT_REV(501000) || NETBSD_LT_REV(105000000) || \
OPENBSD_LT_REV(200006)
#if !defined(_KERNEL) || SOLARIS
/*
* From: NetBSD
* ppsratecheck(): packets (or events) per second limitation.
@ -10111,9 +10064,6 @@ ipf_slowtimer(softc)
ipf_rule_expire(softc);
ipf_sync_expire(softc);
softc->ipf_ticks++;
# if defined(__OpenBSD__)
timeout_add(&ipf_slowtimer_ch, hz/2);
# endif
}

View File

@ -24,29 +24,24 @@
# endif
# include <string.h>
# define _KERNEL
# ifdef __OpenBSD__
struct file;
# endif
# include <sys/uio.h>
# undef _KERNEL
#endif
#if defined(_KERNEL) && (__FreeBSD_version >= 220000)
#if defined(_KERNEL) && defined(__FreeBSD_version)
# include <sys/filio.h>
# include <sys/fcntl.h>
#else
# include <sys/ioctl.h>
#endif
#if !defined(linux)
# include <sys/protosw.h>
#endif
#include <sys/socket.h>
#if defined(_KERNEL)
# include <sys/systm.h>
# if !defined(__SVR4) && !defined(__svr4__) && !defined(linux)
# if !defined(__SVR4)
# include <sys/mbuf.h>
# endif
#endif
#if defined(__SVR4) || defined(__svr4__)
#if defined(__SVR4)
# include <sys/filio.h>
# include <sys/byteorder.h>
# ifdef _KERNEL
@ -55,11 +50,10 @@ struct file;
# include <sys/stream.h>
# include <sys/kmem.h>
#endif
#if (defined(_BSDI_VERSION) && (_BSDI_VERSION >= 199802)) || \
(defined(__FreeBSD_version) &&(__FreeBSD_version >= 400000))
#if defined(__FreeBSD_version)
# include <sys/queue.h>
#endif
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(bsdi)
#if defined(__NetBSD__)
# include <machine/cpu.h>
#endif
#if defined(_KERNEL) && defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
@ -76,10 +70,8 @@ struct file;
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#if !defined(linux)
# include <netinet/ip_var.h>
#endif
#if !defined(_KERNEL) && !defined(__osf__) && !defined(__sgi)
#if !defined(_KERNEL)
# define KERNEL
# define _KERNEL
# define NOT_KERNEL
@ -89,34 +81,26 @@ struct file;
# undef KERNEL
#endif
#include <netinet/tcp.h>
#if defined(IRIX) && (IRIX < 60516) /* IRIX < 6 */
extern struct ifqueue ipintrq; /* ip packet input queue */
#else
# if !defined(__hpux) && !defined(linux)
# if __FreeBSD_version >= 300000
# if defined(__FreeBSD_version)
# include <net/if_var.h>
# if __FreeBSD_version >= 500042
# define IF_QFULL _IF_QFULL
# define IF_DROP _IF_DROP
# endif /* __FreeBSD_version >= 500042 */
# endif
# include <netinet/in_var.h>
# include <netinet/tcp_fsm.h>
# endif
#endif
#include <netinet/udp.h>
#include <netinet/ip_icmp.h>
#include "netinet/ip_compat.h"
#include <netinet/tcpip.h>
#include "netinet/ip_fil.h"
#include "netinet/ip_auth.h"
#if !defined(MENTAT) && !defined(linux)
#if !defined(MENTAT)
# include <net/netisr.h>
# ifdef __FreeBSD__
# include <machine/cpufunc.h>
# endif
#endif
#if (__FreeBSD_version >= 300000)
#if defined(__FreeBSD_version)
# include <sys/malloc.h>
# if defined(_KERNEL) && !defined(IPFILTER_LKM)
# include <sys/libkern.h>
@ -232,9 +216,6 @@ ipf_auth_soft_init(softc, arg)
bzero((char *)softa->ipf_auth_pkts,
softa->ipf_auth_size * sizeof(*softa->ipf_auth_pkts));
#if defined(linux) && defined(_KERNEL)
init_waitqueue_head(&softa->ipf_auth_next_linux);
#endif
return 0;
}
@ -1106,22 +1087,7 @@ ipf_auth_wait(softc, softa, data)
error = EINTR;
}
# else /* SOLARIS */
# ifdef __hpux
{
lock_t *l;
l = get_sleep_lock(&softa->ipf_auth_next);
error = sleep(&softa->ipf_auth_next, PZERO+1);
spinunlock(l);
}
# else
# ifdef __osf__
error = mpsleep(&softa->ipf_auth_next, PSUSP|PCATCH, "ipf_auth_next",
0, &softa->ipf_auth_mx, MS_LOCK_SIMPLE);
# else
error = SLEEP(&softa->ipf_auth_next, "ipf_auth_next");
# endif /* __osf__ */
# endif /* __hpux */
# endif /* SOLARIS */
#endif
MUTEX_EXIT(&softa->ipf_auth_mx);

View File

@ -33,7 +33,7 @@
#endif
#ifndef SOLARIS
# if defined(sun) && (defined(__svr4__) || defined(__SVR4))
# if defined(sun) && defined(__SVR4)
# define SOLARIS 1
# else
# define SOLARIS 0
@ -41,7 +41,7 @@
#endif
#if defined(__SVR4) || defined(__svr4__) || defined(__sgi)
#if defined(__SVR4)
# define index strchr
# if !defined(_KERNEL)
# define bzero(a,b) memset(a,0,b)
@ -62,11 +62,6 @@
# endif
#endif
#if defined(__sgi) || defined(bsdi) || defined(__hpux) || defined(hpux)
struct ether_addr {
u_char ether_addr_octet[6];
};
#endif
# ifdef __STDC__
# define IPL_EXTERN(ep) ipl##ep
@ -100,15 +95,6 @@ struct ether_addr {
(__FreeBSD_version > (x)))
#define FREEBSD_LT_REV(x) (defined(__FreeBSD_version) && \
(__FreeBSD_version < (x)))
#define BSDOS_GE_REV(x) (defined(_BSDI_VERSION) && \
(_BSDI_VERSION >= (x)))
#define BSDOS_GT_REV(x) (defined(_BSDI_VERSION) && \
(_BSDI_VERSION > (x)))
#define BSDOS_LT_REV(x) (defined(_BSDI_VERSION) && \
(_BSDI_VERSION < (x)))
#define OPENBSD_GE_REV(x) (defined(OpenBSD) && (OpenBSD >= (x)))
#define OPENBSD_GT_REV(x) (defined(OpenBSD) && (OpenBSD > (x)))
#define OPENBSD_LT_REV(x) (defined(OpenBSD) && (OpenBSD < (x)))
#define BSD_GE_YEAR(x) (defined(BSD) && (BSD >= (x)))
#define BSD_GT_YEAR(x) (defined(BSD) && (BSD > (x)))
#define BSD_LT_YEAR(x) (defined(BSD) && (BSD < (x)))
@ -321,8 +307,7 @@ typedef union {
#define ipf_isw ipf_lkun_s.ipf_sw
#define ipf_magic ipf_lkun_s.ipf_magic
#if !defined(__GNUC__) || \
(defined(__FreeBSD_version) && (__FreeBSD_version >= 503000))
#if !defined(__GNUC__) || defined(__FreeBSD_version)
# ifndef INLINE
# define INLINE
# endif
@ -473,11 +458,10 @@ extern mb_t *allocmbt(size_t);
#ifdef USE_INET6
# if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || \
defined(__osf__) || defined(linux)
# if defined(__NetBSD__) || defined(__FreeBSD__)
# include <netinet/ip6.h>
# include <netinet/icmp6.h>
# if defined(_KERNEL) && !defined(__osf__)
# if defined(_KERNEL)
# include <netinet6/ip6_var.h>
# endif
typedef struct ip6_hdr ip6_t;
@ -497,21 +481,16 @@ typedef struct ip6_hdr ip6_t;
# define COPYBACK m_copyback
# endif
# if (defined(__NetBSD_Version__) && (__NetBSD_Version__ < 105180000)) || \
defined(__FreeBSD__) || (defined(OpenBSD) && (OpenBSD < 200206)) || \
defined(_BSDI_VERSION)
defined(__FreeBSD__)
# include <vm/vm.h>
# endif
# if !defined(__FreeBSD__) || FREEBSD_GE_REV(300000)
# if NETBSD_GE_REV(105180000) || OPENBSD_GE_REV(200111)
# if NETBSD_GE_REV(105180000)
# include <uvm/uvm_extern.h>
# else
# include <vm/vm_extern.h>
extern vm_map_t kmem_map;
# endif
# include <sys/proc.h>
# else /* !__FreeBSD__ || (__FreeBSD__ && __FreeBSD_version >= 300000) */
# include <vm/vm_kern.h>
# endif /* !__FreeBSD__ || (__FreeBSD__ && __FreeBSD_version >= 300000) */
# ifdef IPFILTER_M_IPFILTER
# include <sys/malloc.h>

View File

@ -9,9 +9,6 @@
# define KERNEL 1
# define _KERNEL 1
#endif
#if defined(__osf__)
# define _PROTO_NET_H_
#endif
#include <sys/errno.h>
#include <sys/types.h>
#include <sys/param.h>
@ -21,9 +18,6 @@
# include <stdlib.h>
# include <string.h>
# define _KERNEL
# ifdef __OpenBSD__
struct file;
# endif
# include <sys/uio.h>
# undef _KERNEL
#else
@ -33,14 +27,12 @@ struct file;
# endif
#endif
#include <sys/time.h>
#if !defined(linux)
# include <sys/protosw.h>
#endif
#include <sys/socket.h>
#if defined(_KERNEL) && (!defined(__SVR4) && !defined(__svr4__))
#if defined(_KERNEL) && !defined(__SVR4)
# include <sys/mbuf.h>
#endif
#if defined(__SVR4) || defined(__svr4__)
#if defined(__SVR4)
# include <sys/filio.h>
# include <sys/byteorder.h>
# ifdef _KERNEL
@ -49,7 +41,7 @@ struct file;
# include <sys/stream.h>
# include <sys/kmem.h>
#endif
#if defined(__FreeBSD_version) && (__FreeBSD_version >= 300000)
#if defined(__FreeBSD_version)
# include <sys/malloc.h>
#endif

View File

@ -11,9 +11,7 @@
#ifndef __IP_FIL_H__
#define __IP_FIL_H__
#if !defined(linux) || !defined(_KERNEL)
# include <netinet/in.h>
#endif
#include "netinet/ip_compat.h"
#include "netinet/ipf_rb.h"
@ -21,15 +19,11 @@
# include <sys/callout.h>
#endif
#if defined(BSD) && defined(_KERNEL)
# if NETBSD_LT_REV(399000000) || defined(__osf__) || FREEBSD_LT_REV(500043)
# include <sys/select.h>
# else
# include <sys/selinfo.h>
# endif
#endif
#ifndef SOLARIS
# if defined(sun) && (defined(__svr4__) || defined(__SVR4))
# if defined(sun) && defined(__SVR4)
# define SOLARIS 1
# else
# define SOLARIS 0
@ -44,7 +38,7 @@
# endif
#endif
#if defined(__STDC__) || defined(__GNUC__) || defined(_AIX51)
#if defined(__STDC__) || defined(__GNUC__)
# define SIOCADAFR _IOW('r', 60, struct ipfobj)
# define SIOCRMAFR _IOW('r', 61, struct ipfobj)
# define SIOCSETFF _IOW('r', 62, u_int)
@ -458,9 +452,6 @@ typedef struct fr_info {
mb_t *fin_qfm; /* pointer to mblk where pkt starts */
void *fin_qpi;
char fin_ifname[LIFNAMSIZ];
#endif
#ifdef __sgi
void *fin_hbuf;
#endif
void *fin_fraghdr; /* pointer to start of ipv6 frag hdr */
} fr_info_t;
@ -1425,10 +1416,6 @@ typedef struct ipftune {
/*
** HPUX Port
*/
#ifdef __hpux
/* HP-UX locking sequence deadlock detection module lock MAJOR ID */
# define IPF_SMAJ 0 /* temp assignment XXX, not critical */
#endif
#if !defined(CDEV_MAJOR) && defined (__FreeBSD_version) && \
(__FreeBSD_version >= 220000)
@ -1624,22 +1611,14 @@ typedef struct ipf_main_softc_s {
frentry_t *ipf_rule_explist[2];
ipftoken_t *ipf_token_head;
ipftoken_t **ipf_token_tail;
#if defined(__FreeBSD_version) && (__FreeBSD_version >= 300000) && \
defined(_KERNEL)
#if defined(__FreeBSD_version) && defined(_KERNEL)
struct callout ipf_slow_ch;
#endif
#if defined(linux) && defined(_KERNEL)
struct timer_list ipf_timer;
#endif
#if NETBSD_GE_REV(104040000)
struct callout ipf_slow_ch;
#endif
#if SOLARIS
# if SOLARIS2 >= 7
timeout_id_t ipf_slow_ch;
# else
int ipf_slow_ch;
# endif
#endif
#if defined(_KERNEL)
# if SOLARIS
@ -1662,12 +1641,7 @@ typedef struct ipf_main_softc_s {
hook_t *ipf_hk_loop_v6_out;
# endif
# else
# if defined(linux) && defined(_KERNEL)
struct poll_table_struct ipf_selwait[IPL_LOGSIZE];
wait_queue_head_t iplh_linux[IPL_LOGSIZE];
# else
struct selinfo ipf_selwait[IPL_LOGSIZE];
# endif
# endif
#endif
void *ipf_slow;
@ -1697,67 +1671,27 @@ extern void ipfilterattach __P((int));
extern int ipl_enable __P((void));
extern int ipl_disable __P((void));
# ifdef MENTAT
/* XXX MENTAT is always defined for Solaris */
extern int ipf_check __P((void *, struct ip *, int, void *, int, void *,
mblk_t **));
# if SOLARIS
extern void ipf_prependmbt(fr_info_t *, mblk_t *);
# if SOLARIS2 >= 7
extern int ipfioctl __P((dev_t, int, intptr_t, int, cred_t *, int *));
# else
extern int ipfioctl __P((dev_t, int, int *, int, cred_t *, int *));
# endif
# endif
# ifdef __hpux
extern int ipfioctl __P((dev_t, int, caddr_t, int));
extern int ipf_select __P((dev_t, int));
# endif
extern int ipf_qout __P((queue_t *, mblk_t *));
# else /* MENTAT */
/* XXX MENTAT is never defined for FreeBSD & NetBSD */
extern int ipf_check __P((void *, struct ip *, int, void *, int, mb_t **));
extern int (*fr_checkp) __P((ip_t *, int, void *, int, mb_t **));
extern size_t mbufchainlen __P((mb_t *));
# ifdef __sgi
# include <sys/cred.h>
extern int ipfioctl __P((dev_t, int, caddr_t, int, cred_t *, int *));
extern int ipfilter_sgi_attach __P((void));
extern void ipfilter_sgi_detach __P((void));
extern void ipfilter_sgi_intfsync __P((void));
# else
# ifdef IPFILTER_LKM
extern int ipf_identify __P((char *));
# endif
# if BSDOS_GE_REV(199510) || FREEBSD_GE_REV(220000) || \
(defined(NetBSD) && (NetBSD >= 199511)) || defined(__OpenBSD__)
# if defined(__NetBSD__) || BSDOS_GE_REV(199701) || \
defined(__OpenBSD__) || FREEBSD_GE_REV(300000)
# if (__FreeBSD_version >= 500024)
# if (__FreeBSD_version >= 502116)
# if defined(__FreeBSD_version)
extern int ipfioctl __P((struct cdev*, u_long, caddr_t, int, struct thread *));
# else
extern int ipfioctl __P((dev_t, u_long, caddr_t, int, struct thread *));
# endif /* __FreeBSD_version >= 502116 */
# else
# if NETBSD_GE_REV(499001000)
# elif defined(__NetBSD__)
extern int ipfioctl __P((dev_t, u_long, void *, int, struct lwp *));
# else
# if NETBSD_GE_REV(399001400)
extern int ipfioctl __P((dev_t, u_long, caddr_t, int, struct lwp *));
# else
extern int ipfioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
# endif
# endif
# endif /* __FreeBSD_version >= 500024 */
# else
extern int ipfioctl __P((dev_t, int, caddr_t, int, struct proc *));
# endif
# else
# ifdef linux
extern int ipfioctl __P((struct inode *, struct file *, u_int, u_long));
# else
extern int ipfioctl __P((dev_t, int, caddr_t, int));
# endif
# endif /* (_BSDI_VERSION >= 199510) */
# endif /* __ sgi */
# endif
# endif /* MENTAT */
# if defined(__FreeBSD_version)

View File

@ -16,30 +16,21 @@
#include <sys/param.h>
#include <sys/time.h>
#include <sys/file.h>
#ifdef __hpux
# include <sys/timeout.h>
#endif
#if !defined(_KERNEL)
# include <stdio.h>
# include <string.h>
# include <stdlib.h>
# define _KERNEL
# ifdef __OpenBSD__
struct file;
# endif
# include <sys/uio.h>
# undef _KERNEL
#endif
#if defined(_KERNEL) && \
defined(__FreeBSD_version) && (__FreeBSD_version >= 220000)
#if defined(_KERNEL) && defined(__FreeBSD_version)
# include <sys/filio.h>
# include <sys/fcntl.h>
#else
# include <sys/ioctl.h>
#endif
#if !defined(linux)
# include <sys/protosw.h>
#endif
#include <sys/socket.h>
#if defined(_KERNEL)
# include <sys/systm.h>
@ -48,7 +39,7 @@ struct file;
# endif
#endif
#if !defined(__SVR4) && !defined(__svr4__)
# if defined(_KERNEL) && !defined(__sgi) && !defined(AIX)
# if defined(_KERNEL)
# include <sys/kernel.h>
# endif
#else
@ -66,9 +57,7 @@ struct file;
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#if !defined(linux)
# include <netinet/ip_var.h>
#endif
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <netinet/ip_icmp.h>

View File

@ -1308,11 +1308,7 @@ ipf_p_ftp_process(softf, fin, nat, ftp, rv)
t = &ftp->ftp_side[1 - rv];
thseq = ntohl(tcp->th_seq);
thack = ntohl(tcp->th_ack);
#ifdef __sgi
mlen = fin->fin_plen - off;
#else
mlen = MSGDSIZE(m) - off;
#endif
DT3(process_debug, tcphdr_t *, tcp, int, off, int, mlen);
if (softf->ipf_p_ftp_debug & DEBUG_INFO)
@ -1609,11 +1605,7 @@ ipf_p_ftp_process(softf, fin, nat, ftp, rv)
if (tcp->th_flags & TH_FIN)
f->ftps_seq[1]++;
if (softf->ipf_p_ftp_debug & DEBUG_PARSE_INFO) {
#ifdef __sgi
mlen = fin->fin_plen;
#else
mlen = MSGDSIZE(m);
#endif
mlen -= off;
printf("ftps_seq[1] = %x inc %d len %d\n",
f->ftps_seq[1], inc, mlen);

View File

@ -20,22 +20,18 @@
# include <stdlib.h>
# include <string.h>
# define _KERNEL
# ifdef __OpenBSD__
struct file;
# endif
# include <sys/uio.h>
# undef _KERNEL
#endif
#include <sys/socket.h>
#if defined(__FreeBSD_version) && (__FreeBSD_version >= 300000)
#if defined(__FreeBSD_version)
# include <sys/malloc.h>
#endif
#if defined(__FreeBSD__)
# include <sys/cdefs.h>
# include <sys/proc.h>
#endif
#if !defined(__svr4__) && !defined(__SVR4) && !defined(__hpux) && \
!defined(linux)
#if !defined(__SVR4)
# include <sys/mbuf.h>
#endif
#if defined(_KERNEL)

View File

@ -278,11 +278,7 @@ ipf_p_irc_send(fin, nat)
bzero(ctcpbuf, sizeof(ctcpbuf));
off = (char *)tcp - (char *)ip + (TCP_OFF(tcp) << 2) + fin->fin_ipoff;
#ifdef __sgi
dlen = fin->fin_plen - off;
#else
dlen = MSGDSIZE(m) - off;
#endif
if (dlen <= 0)
return 0;
COPYDATA(m, off, MIN(sizeof(ctcpbuf), dlen), ctcpbuf);
@ -361,7 +357,7 @@ ipf_p_irc_send(fin, nat)
fin->fin_flx |= FI_DOCKSUM;
if (inc != 0) {
#if defined(MENTAT) || defined(__sgi)
#if defined(MENTAT)
register u_32_t sum1, sum2;
sum1 = fin->fin_plen;

View File

@ -19,7 +19,7 @@
# include <osreldate.h>
#endif
#ifndef SOLARIS
# if defined(sun) && (defined(__svr4__) || defined(__SVR4))
# if defined(sun) && defined(__SVR4)
# define SOLARIS 1
# else
# define SOLARIS 0
@ -35,15 +35,11 @@
# include <ctype.h>
# define _KERNEL
# define KERNEL
# ifdef __OpenBSD__
struct file;
# endif
# include <sys/uio.h>
# undef _KERNEL
# undef KERNEL
#endif
#if (defined(__FreeBSD_version) && (__FreeBSD_version >= 220000)) && \
defined(_KERNEL)
#if defined(__FreeBSD_version) && defined(_KERNEL)
# include <sys/fcntl.h>
# include <sys/filio.h>
#else
@ -56,21 +52,15 @@ struct file;
# include <sys/proc.h>
# endif
#endif /* _KERNEL */
#if !SOLARIS && !defined(__hpux) && !defined(linux)
# if (defined(NetBSD) && (NetBSD > 199609)) || \
(defined(OpenBSD) && (OpenBSD > 199603)) || \
(defined(__FreeBSD_version) && (__FreeBSD_version >= 300000))
# if defined(NetBSD) || defined(__FreeBSD_version)
# include <sys/dirent.h>
# else
# include <sys/dir.h>
# endif
# include <sys/mbuf.h>
# include <sys/select.h>
# if __FreeBSD_version >= 500000
# endif
# if defined(__FreeBSD_version)
# include <sys/selinfo.h>
# endif
#else
# if !defined(__hpux) && defined(_KERNEL)
#if SOLARIS && defined(_KERNEL)
# include <sys/filio.h>
# include <sys/cred.h>
# include <sys/ddi.h>
@ -80,24 +70,18 @@ struct file;
# include <sys/mkdev.h>
# include <sys/dditypes.h>
# include <sys/cmn_err.h>
# endif /* !__hpux */
#endif /* !SOLARIS && !__hpux */
#if !defined(linux)
#endif /* SOLARIS && _KERNEL */
# include <sys/protosw.h>
#endif
#include <sys/socket.h>
#include <net/if.h>
#ifdef sun
# include <net/af.h>
#endif
#if __FreeBSD_version >= 300000
#if defined(__FreeBSD_version)
# include <net/if_var.h>
#endif
#include <netinet/in.h>
#ifdef __sgi
# include <sys/ddi.h>
#endif
# include <netinet/in_var.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
@ -107,9 +91,7 @@ struct file;
#ifdef USE_INET6
# include <netinet/icmp6.h>
#endif
#if !defined(linux)
# include <netinet/ip_var.h>
#endif
#ifndef _KERNEL
# include <syslog.h>
#endif
@ -120,7 +102,7 @@ struct file;
#include "netinet/ip_frag.h"
#include "netinet/ip_state.h"
#include "netinet/ip_auth.h"
#if (__FreeBSD_version >= 300000) || defined(__NetBSD__)
#if defined(__FreeBSD_version) || defined(__NetBSD__)
# include <sys/malloc.h>
#endif
/* END OF INCLUDES */
@ -138,12 +120,6 @@ typedef struct ipf_log_softc_s {
ipfmutex_t ipl_mutex[IPL_LOGSIZE];
# if SOLARIS && defined(_KERNEL)
kcondvar_t ipl_wait[IPL_LOGSIZE];
# endif
# if defined(linux) && defined(_KERNEL)
wait_queue_head_t iplh_linux[IPL_LOGSIZE];
# endif
# if defined(__hpux) && defined(_KERNEL)
iplog_select_t ipl_ss[IPL_LOGSIZE];
# endif
iplog_t **iplh[IPL_LOGSIZE];
iplog_t *iplt[IPL_LOGSIZE];
@ -386,11 +362,11 @@ ipf_log_pkt(fin, flags)
ipflog_t ipfl;
u_char p;
mb_t *m;
# if (SOLARIS || defined(__hpux)) && defined(_KERNEL) && !defined(FW_HOOKS)
# if SOLARIS && defined(_KERNEL) && !defined(FW_HOOKS)
qif_t *ifp;
# else
struct ifnet *ifp;
# endif /* SOLARIS || __hpux */
# endif /* SOLARIS */
m = fin->fin_m;
if (m == NULL)
@ -460,14 +436,14 @@ ipf_log_pkt(fin, flags)
* Get the interface number and name to which this packet is
* currently associated.
*/
# if (SOLARIS || defined(__hpux)) && defined(_KERNEL)
# if SOLARIS && defined(_KERNEL)
# if !defined(FW_HOOKS)
ipfl.fl_unit = (u_int)ifp->qf_ppa;
# endif
COPYIFNAME(fin->fin_v, ifp, ipfl.fl_ifname);
# else
# if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199603)) || \
OPENBSD_GE_REV(199603) || defined(linux) || FREEBSD_GE_REV(501113)
defined(__FreeBSD_version)
COPYIFNAME(fin->fin_v, ifp, ipfl.fl_ifname);
# else
ipfl.fl_unit = (u_int)ifp->if_unit;
@ -738,32 +714,9 @@ ipf_log_read(softc, unit, uio)
return EINTR;
}
# else
# if defined(__hpux) && defined(_KERNEL)
lock_t *l;
# ifdef IPL_SELECT
if (uio->uio_fpflags & (FNBLOCK|FNDELAY)) {
/* this is no blocking system call */
softl->ipl_readers[unit]--;
MUTEX_EXIT(&softl->ipl_mutex[unit]);
return 0;
}
# endif
MUTEX_EXIT(&softl->ipl_mutex[unit]);
l = get_sleep_lock(&softl->iplh[unit]);
error = sleep(&softl->iplh[unit], PZERO+1);
spinunlock(l);
# else
# if defined(__osf__) && defined(_KERNEL)
error = mpsleep(&softl->iplh[unit], PSUSP|PCATCH, "ipfread", 0,
&softl->ipl_mutex, MS_LOCK_SIMPLE);
# else
MUTEX_EXIT(&softl->ipl_mutex[unit]);
SPL_X(s);
error = SLEEP(unit + softl->iplh, "ipl sleep");
# endif /* __osf__ */
# endif /* __hpux */
SPL_NET(s);
MUTEX_ENTER(&softl->ipl_mutex[unit]);
if (error) {
@ -781,8 +734,7 @@ ipf_log_read(softc, unit, uio)
return EIO;
}
# if (defined(BSD) && (BSD >= 199101)) || defined(__FreeBSD__) || \
defined(__osf__)
# if (defined(BSD) && (BSD >= 199101)) || defined(__FreeBSD__)
uio->uio_rw = UIO_READ;
# endif

View File

@ -10,15 +10,12 @@
# define KERNEL 1
# define _KERNEL 1
#endif
#if defined(__osf__)
# define _PROTO_NET_H_
#endif
#include <sys/param.h>
#include <sys/errno.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/file.h>
#if __FreeBSD_version >= 220000 && defined(_KERNEL)
#if defined(__FreeBSD_version) && defined(_KERNEL)
# include <sys/fcntl.h>
# include <sys/filio.h>
#else
@ -29,9 +26,6 @@
# include <string.h>
# include <stdlib.h>
# define _KERNEL
# ifdef __OpenBSD__
struct file;
# endif
# include <sys/uio.h>
# undef _KERNEL
#endif
@ -43,7 +37,7 @@ struct file;
#endif
#if defined(_KERNEL)
# include <sys/systm.h>
# if !defined(__SVR4) && !defined(__svr4__)
# if !defined(__SVR4)
# include <sys/mbuf.h>
# endif
#else

View File

@ -31,27 +31,22 @@ struct file;
# include <sys/uio.h>
# undef KERNEL
#endif
#if defined(_KERNEL) && \
defined(__FreeBSD_version) && (__FreeBSD_version >= 220000)
#if defined(_KERNEL) && defined(__FreeBSD_version)
# include <sys/filio.h>
# include <sys/fcntl.h>
#else
# include <sys/ioctl.h>
#endif
#if !defined(AIX)
# include <sys/fcntl.h>
#endif
#if !defined(linux)
# include <sys/protosw.h>
#endif
#include <sys/socket.h>
#if defined(_KERNEL)
# include <sys/systm.h>
# if !defined(__SVR4) && !defined(__svr4__)
# if !defined(__SVR4)
# include <sys/mbuf.h>
# endif
#endif
#if defined(__SVR4) || defined(__svr4__)
#if defined(__SVR4)
# include <sys/filio.h>
# include <sys/byteorder.h>
# ifdef KERNEL
@ -60,11 +55,11 @@ struct file;
# include <sys/stream.h>
# include <sys/kmem.h>
#endif
#if __FreeBSD_version >= 300000
#if defined(__FreeBSD_version)
# include <sys/queue.h>
#endif
#include <net/if.h>
#if __FreeBSD_version >= 300000
#if defined(__FreeBSD_version)
# include <net/if_var.h>
#endif
#ifdef sun
@ -80,9 +75,7 @@ struct file;
extern struct ifnet vpnif;
#endif
#if !defined(linux)
# include <netinet/ip_var.h>
#endif
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <netinet/ip_icmp.h>
@ -97,7 +90,7 @@ extern struct ifnet vpnif;
#include "netinet/ip_lookup.h"
#include "netinet/ip_dstlist.h"
#include "netinet/ip_sync.h"
#if FREEBSD_GE_REV(300000)
#if defined(__FreeBSD_version)
# include <sys/malloc.h>
#endif
#ifdef HAS_SYS_MD5_H
@ -1024,7 +1017,7 @@ ipf_nat_ioctl(softc, data, cmd, mode, uid, ctx)
KAUTH_REQ_NETWORK_FIREWALL_FW,
NULL, NULL, NULL))
# else
# if defined(__FreeBSD_version) && (__FreeBSD_version >= 500034)
# if defined(__FreeBSD_version)
if (securelevel_ge(curthread->td_ucred, 3) && (mode & FWRITE))
# else
if ((securelevel >= 3) && (mode & FWRITE))
@ -1036,11 +1029,7 @@ ipf_nat_ioctl(softc, data, cmd, mode, uid, ctx)
}
#endif
#if defined(__osf__) && defined(_KERNEL)
getlock = 0;
#else
getlock = (mode & NAT_LOCKHELD) ? 0 : 1;
#endif
n = NULL;
nt = NULL;
@ -3302,7 +3291,7 @@ ipf_nat_finalise(fin, nat)
u_32_t sum1, sum2, sumd;
frentry_t *fr;
u_32_t flags;
#if SOLARIS && defined(_KERNEL) && (SOLARIS2 >= 6) && defined(ICK_M_CTL_MAGIC)
#if SOLARIS && defined(_KERNEL) && defined(ICK_M_CTL_MAGIC)
qpktinfo_t *qpi = fin->fin_qpi;
#endif
@ -5234,8 +5223,8 @@ ipf_nat_out(fin, nat, natadd, nflags)
uh = (udphdr_t *)(ip + 1);
uh->uh_ulen += fin->fin_plen;
uh->uh_ulen = htons(uh->uh_ulen);
#if !defined(_KERNEL) || defined(MENTAT) || defined(__sgi) || \
defined(linux) || defined(BRIDGE_IPF) || defined(__FreeBSD__)
#if !defined(_KERNEL) || defined(MENTAT) || \
defined(BRIDGE_IPF) || defined(__FreeBSD__)
ipf_fix_outcksum(0, &ip->ip_sum, sumd, 0);
#endif
@ -5655,8 +5644,7 @@ ipf_nat_in(fin, nat, natadd, nflags)
}
fin->fin_ip->ip_dst = nat->nat_osrcip;
fin->fin_daddr = nat->nat_osrcaddr;
#if !defined(_KERNEL) || defined(MENTAT) || defined(__sgi) || \
defined(__osf__) || defined(linux)
#if !defined(_KERNEL) || defined(MENTAT)
ipf_fix_incksum(0, &fin->fin_ip->ip_sum, ipsumd, 0);
#endif
break;
@ -5688,8 +5676,7 @@ ipf_nat_in(fin, nat, natadd, nflags)
sum2 += ntohs(ip->ip_off) & IP_DF;
CALC_SUMD(sum1, sum2, sumd);
#if !defined(_KERNEL) || defined(MENTAT) || defined(__sgi) || \
defined(__osf__) || defined(linux)
#if !defined(_KERNEL) || defined(MENTAT)
ipf_fix_outcksum(0, &ip->ip_sum, sumd, 0);
#endif
PREP_MB_T(fin, m);
@ -6208,27 +6195,6 @@ ipf_nat_log(softc, softn, nat, action)
}
#if defined(__OpenBSD__)
/* ------------------------------------------------------------------------ */
/* Function: ipf_nat_ifdetach */
/* Returns: Nil */
/* Parameters: ifp(I) - pointer to network interface */
/* */
/* Compatibility interface for OpenBSD to trigger the correct updating of */
/* interface references within IPFilter. */
/* ------------------------------------------------------------------------ */
void
ipf_nat_ifdetach(ifp)
void *ifp;
{
ipf_main_softc_t *softc;
softc = ipf_get_softc(0);
ipf_sync(ifp);
return;
}
#endif
/* ------------------------------------------------------------------------ */
@ -7459,8 +7425,7 @@ ipf_nat_decap(fin, nat)
CALC_SUMD(sum1, sum2, sumd);
fin->fin_ip->ip_dst = nat->nat_osrcip;
fin->fin_daddr = nat->nat_osrcaddr;
#if !defined(_KERNEL) || defined(MENTAT) || defined(__sgi) || \
defined(__osf__) || defined(linux)
#if !defined(_KERNEL) || defined(MENTAT)
ipf_fix_outcksum(0, &fin->fin_ip->ip_sum, sumd, 0);
#endif
}

View File

@ -14,7 +14,7 @@
#define __IP_NAT_H__
#ifndef SOLARIS
# if defined(sun) && (defined(__svr4__) || defined(__SVR4))
# if defined(sun) && defined(__SVR4)
# define SOLARIS 1
# else
# define SOLARIS 0
@ -694,9 +694,6 @@ extern int ipf_nat_hostmap_rehash __P((ipf_main_softc_t *,
ipftuneable_t *, ipftuneval_t *));
extern nat_t *ipf_nat_icmperrorlookup __P((fr_info_t *, int));
extern nat_t *ipf_nat_icmperror __P((fr_info_t *, u_int *, int));
#if defined(__OpenBSD__)
extern void ipf_nat_ifdetach __P((void *));
#endif
extern int ipf_nat_init __P((void));
extern nat_t *ipf_nat_inlookup __P((fr_info_t *, u_int, u_int,
struct in_addr, struct in_addr));

View File

@ -29,26 +29,22 @@ struct file;
# include <sys/uio.h>
# undef _KERNEL
#endif
#if defined(_KERNEL) && (__FreeBSD_version >= 220000)
#if defined(_KERNEL) && defined(__FreeBSD_version)
# include <sys/filio.h>
# include <sys/fcntl.h>
#else
# include <sys/ioctl.h>
#endif
#if !defined(AIX)
# include <sys/fcntl.h>
#endif
#if !defined(linux)
# include <sys/protosw.h>
#endif
#include <sys/socket.h>
#if defined(_KERNEL)
# include <sys/systm.h>
# if !defined(__SVR4) && !defined(__svr4__)
# if !defined(__SVR4)
# include <sys/mbuf.h>
# endif
#endif
#if defined(__SVR4) || defined(__svr4__)
#if defined(__SVR4)
# include <sys/filio.h>
# include <sys/byteorder.h>
# ifdef _KERNEL
@ -57,11 +53,11 @@ struct file;
# include <sys/stream.h>
# include <sys/kmem.h>
#endif
#if __FreeBSD_version >= 300000
#if defined(__FreeBSD_version)
# include <sys/queue.h>
#endif
#include <net/if.h>
#if __FreeBSD_version >= 300000
#if defined(__FreeBSD_version)
# include <net/if_var.h>
#endif
#ifdef sun
@ -78,9 +74,7 @@ struct file;
extern struct ifnet vpnif;
#endif
#if !defined(linux)
# include <netinet/ip_var.h>
#endif
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <netinet/ip_icmp.h>
@ -94,7 +88,7 @@ extern struct ifnet vpnif;
#include "netinet/ip_lookup.h"
#include "netinet/ip_dstlist.h"
#include "netinet/ip_sync.h"
#if (__FreeBSD_version >= 300000)
#if defined(__FreeBSD_version)
# include <sys/malloc.h>
#endif
#ifdef HAS_SYS_MD5_H
@ -970,7 +964,7 @@ ipf_nat6_add(fin, np, natsave, flags, direction)
u_int nflags;
natinfo_t ni;
int move;
#if SOLARIS && defined(_KERNEL) && (SOLARIS2 >= 6) && defined(ICK_M_CTL_MAGIC)
#if SOLARIS && defined(_KERNEL) && defined(ICK_M_CTL_MAGIC)
qpktinfo_t *qpi = fin->fin_qpi;
#endif

View File

@ -9,9 +9,6 @@
# define KERNEL 1
# define _KERNEL 1
#endif
#if defined(__osf__)
# define _PROTO_NET_H_
#endif
#include <sys/errno.h>
#include <sys/types.h>
#include <sys/param.h>
@ -21,9 +18,6 @@
# include <stdlib.h>
# include <string.h>
# define _KERNEL
# ifdef __OpenBSD__
struct file;
# endif
# include <sys/uio.h>
# undef _KERNEL
#else
@ -36,7 +30,7 @@ struct file;
#if defined(_KERNEL) && !defined(SOLARIS2)
# include <sys/mbuf.h>
#endif
#if defined(__SVR4) || defined(__svr4__)
#if defined(__SVR4)
# include <sys/byteorder.h>
# ifdef _KERNEL
# include <sys/dditypes.h>
@ -44,7 +38,7 @@ struct file;
# include <sys/stream.h>
# include <sys/kmem.h>
#endif
#if defined(__FreeBSD_version) && (__FreeBSD_version >= 300000)
#if defined(__FreeBSD_version)
# include <sys/malloc.h>
#endif

View File

@ -16,43 +16,34 @@
#include <sys/param.h>
#include <sys/time.h>
#include <sys/file.h>
#if !defined(AIX)
# include <sys/fcntl.h>
#endif
#if !defined(_KERNEL) && !defined(__KERNEL__)
# include <stdio.h>
# include <string.h>
# include <stdlib.h>
# include <ctype.h>
# define _KERNEL
# ifdef __OpenBSD__
struct file;
# endif
# include <sys/uio.h>
# undef _KERNEL
#endif
#if !defined(linux)
# include <sys/protosw.h>
#endif
#include <sys/socket.h>
#if defined(_KERNEL)
# if !defined(__NetBSD__) && !defined(sun) && !defined(__osf__) && \
!defined(__OpenBSD__) && !defined(__hpux) && !defined(__sgi) && \
!defined(AIX)
#ifdef __FreeBSD_version
# include <sys/ctype.h>
# endif
# include <sys/systm.h>
# if !defined(__SVR4) && !defined(__svr4__)
# if !defined(__SVR4)
# include <sys/mbuf.h>
# endif
#endif
#if defined(_KERNEL) && (__FreeBSD_version >= 220000)
#if defined(_KERNEL) && defined(__FreeBSD_version)
# include <sys/filio.h>
# include <sys/fcntl.h>
#else
# include <sys/ioctl.h>
#endif
#if defined(__SVR4) || defined(__svr4__)
#if defined(__SVR4)
# include <sys/byteorder.h>
# ifdef _KERNEL
# include <sys/dditypes.h>
@ -64,7 +55,7 @@ struct file;
# include <sys/queue.h>
#endif
#include <net/if.h>
#if defined(__FreeBSD_version) && (__FreeBSD_version >= 800000) && defined(_KERNEL)
#if defined(__FreeBSD_version) && defined(_KERNEL)
#include <net/vnet.h>
#else
#define CURVNET_SET(arg)
@ -79,9 +70,7 @@ struct file;
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#ifndef linux
# include <netinet/ip_var.h>
#endif
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <netinet/ip_icmp.h>
@ -91,7 +80,7 @@ struct file;
#include "netinet/ip_nat.h"
#include "netinet/ip_state.h"
#include "netinet/ip_proxy.h"
#if (__FreeBSD_version >= 300000)
#if defined(__FreeBSD_version)
# include <sys/malloc.h>
#endif
@ -925,7 +914,7 @@ ipf_proxy_check(fin, nat)
ip_t *ip;
short rv;
int err;
#if !defined(_KERNEL) || defined(MENTAT) || defined(__sgi)
#if !defined(_KERNEL) || defined(MENTAT)
u_32_t s1, s2, sd;
#endif
@ -1017,7 +1006,7 @@ ipf_proxy_check(fin, nat)
* packet.
*/
adjlen = APR_INC(err);
#if !defined(_KERNEL) || defined(MENTAT) || defined(__sgi)
#if !defined(_KERNEL) || defined(MENTAT)
s1 = LONG_SUM(fin->fin_plen - adjlen);
s2 = LONG_SUM(fin->fin_plen);
CALC_SUMD(s1, s2, sd);

View File

@ -105,11 +105,7 @@ ipf_p_raudio_out(arg, fin, aps, nat)
off = (char *)tcp - (char *)fin->fin_ip;
off += (TCP_OFF(tcp) << 2) + fin->fin_ipoff;
#ifdef __sgi
dlen = fin->fin_plen - off;
#else
dlen = MSGDSIZE(m) - off;
#endif
if (dlen <= 0)
return 0;
@ -222,11 +218,7 @@ ipf_p_raudio_in(arg, fin, aps, nat)
off = (char *)tcp - (char *)fin->fin_ip;
off += (TCP_OFF(tcp) << 2) + fin->fin_ipoff;
#ifdef __sgi
dlen = fin->fin_plen - off;
#else
dlen = MSGDSIZE(m) - off;
#endif
if (dlen <= 0)
return 0;

View File

@ -10,9 +10,6 @@
# define _KERNEL 1
#endif
#include <sys/param.h>
#if defined(__hpux) && (HPUXREV >= 1111) && !defined(_KERNEL)
# include <sys/kern_svcs.h>
#endif
#include <sys/types.h>
#include <sys/time.h>
#include <sys/errno.h>
@ -20,21 +17,16 @@
# include <stdlib.h>
# include <string.h>
# define _KERNEL
# ifdef __OpenBSD__
struct file;
# endif
# include <sys/uio.h>
# undef _KERNEL
#else
# include <sys/systm.h>
# if !defined(__svr4__) && !defined(__SVR4)
# if !defined(__SVR4)
# include <sys/mbuf.h>
# endif
#endif
#include <sys/socket.h>
#if !defined(__hpux) && !defined(__osf__) && !defined(linux) && !defined(AIX)
# include <sys/ioccom.h>
#endif
#ifdef __FreeBSD__
# include <sys/filio.h>
# include <sys/malloc.h>

View File

@ -20,7 +20,7 @@
#include <sys/param.h>
#include <sys/file.h>
#if defined(_KERNEL) && defined(__FreeBSD_version) && \
(__FreeBSD_version >= 400000) && !defined(KLD_MODULE)
!defined(KLD_MODULE)
#include "opt_inet6.h"
#endif
#if !defined(_KERNEL) && !defined(__KERNEL__)
@ -28,30 +28,25 @@
# include <stdlib.h>
# include <string.h>
# define _KERNEL
# ifdef __OpenBSD__
struct file;
# endif
# include <sys/uio.h>
# undef _KERNEL
#endif
#if defined(_KERNEL) && (__FreeBSD_version >= 220000)
#if defined(_KERNEL) && defined(__FreeBSD_version)
# include <sys/filio.h>
# include <sys/fcntl.h>
#else
# include <sys/ioctl.h>
#endif
#include <sys/time.h>
#if !defined(linux)
# include <sys/protosw.h>
#endif
#include <sys/socket.h>
#if defined(_KERNEL)
# include <sys/systm.h>
# if !defined(__SVR4) && !defined(__svr4__)
# if !defined(__SVR4)
# include <sys/mbuf.h>
# endif
#endif
#if defined(__SVR4) || defined(__svr4__)
#if defined(__SVR4)
# include <sys/filio.h>
# include <sys/byteorder.h>
# ifdef _KERNEL
@ -69,9 +64,7 @@ struct file;
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#if !defined(__hpux) && !defined(linux)
# include <netinet/tcp_fsm.h>
#endif
#include <netinet/udp.h>
#include <netinet/ip_icmp.h>
#if !defined(_KERNEL)

View File

@ -21,15 +21,12 @@
# include <string.h>
# define _KERNEL
# define KERNEL
# ifdef __OpenBSD__
struct file;
# endif
# include <sys/uio.h>
# undef _KERNEL
# undef KERNEL
#else
# include <sys/systm.h>
# if !defined(__SVR4) && !defined(__svr4__)
# if !defined(__SVR4)
# include <sys/mbuf.h>
# endif
# include <sys/select.h>
@ -40,18 +37,16 @@ struct file;
#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000)
# include <sys/proc.h>
#endif
#if defined(_KERNEL) && (__FreeBSD_version >= 220000)
#if defined(_KERNEL) && defined(__FreeBSD_version)
# include <sys/filio.h>
# include <sys/fcntl.h>
#else
# include <sys/ioctl.h>
#endif
#include <sys/time.h>
#if !defined(linux)
# include <sys/protosw.h>
#endif
#include <sys/socket.h>
#if defined(__SVR4) || defined(__svr4__)
#if defined(__SVR4)
# include <sys/filio.h>
# include <sys/byteorder.h>
# ifdef _KERNEL
@ -69,12 +64,8 @@ struct file;
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#if !defined(linux)
# include <netinet/ip_var.h>
#endif
#if !defined(__hpux) && !defined(linux)
# include <netinet/tcp_fsm.h>
#endif
#include <netinet/udp.h>
#include <netinet/ip_icmp.h>
#include "netinet/ip_compat.h"
@ -88,7 +79,7 @@ struct file;
#ifdef USE_INET6
#include <netinet/icmp6.h>
#endif
#if (__FreeBSD_version >= 300000)
#if defined(__FreeBSD_version)
# include <sys/malloc.h>
# if defined(_KERNEL) && !defined(IPFILTER_LKM)
# include <sys/libkern.h>
@ -111,9 +102,6 @@ typedef struct ipf_sync_softc_s {
ipfrwlock_t ipf_syncnat;
#if SOLARIS && defined(_KERNEL)
kcondvar_t ipslwait;
#endif
#if defined(linux) && defined(_KERNEL)
wait_queue_head_t sl_tail_linux;
#endif
synclist_t **syncstatetab;
synclist_t **syncnattab;
@ -308,7 +296,7 @@ ipf_sync_soft_destroy(softc, arg)
}
# if !defined(sparc) && !defined(__hppa)
# if !defined(sparc)
/* ------------------------------------------------------------------------ */
/* Function: ipf_sync_tcporder */
/* Returns: Nil */
@ -418,11 +406,11 @@ ipf_sync_storder(way, ips)
ips->is_smsk[1] = ntohl(ips->is_smsk[1]);
}
}
# else /* !defined(sparc) && !defined(__hppa) */
# else /* !defined(sparc) */
# define ipf_sync_tcporder(x,y)
# define ipf_sync_natorder(x,y)
# define ipf_sync_storder(x,y)
# endif /* !defined(sparc) && !defined(__hppa) */
# endif /* !defined(sparc) */
/* ------------------------------------------------------------------------ */
@ -449,7 +437,7 @@ ipf_sync_write(softc, uio)
int err = 0;
# if BSD_GE_YEAR(199306) || defined(__FreeBSD__) || defined(__osf__)
# if BSD_GE_YEAR(199306) || defined(__FreeBSD__)
uio->uio_rw = UIO_WRITE;
# endif
@ -597,7 +585,7 @@ ipf_sync_read(softc, uio)
return EINVAL;
}
# if BSD_GE_YEAR(199306) || defined(__FreeBSD__) || defined(__osf__)
# if BSD_GE_YEAR(199306) || defined(__FreeBSD__)
uio->uio_rw = UIO_READ;
# endif
@ -612,28 +600,6 @@ ipf_sync_read(softc, uio)
return EINTR;
}
# else
# ifdef __hpux
{
lock_t *l;
l = get_sleep_lock(&softs->sl_tail);
err = sleep(&softs->sl_tail, PZERO+1);
if (err) {
MUTEX_EXIT(&softs->ipsl_mutex);
IPFERROR(110010);
return EINTR;
}
spinunlock(l);
}
# else /* __hpux */
# ifdef __osf__
err = mpsleep(&softs->sl_tail, PSUSP|PCATCH, "ipl sleep", 0,
&softs->ipsl_mutex, MS_LOCK_SIMPLE);
if (err) {
IPFERROR(110011);
return EINTR;
}
# else
MUTEX_EXIT(&softs->ipsl_mutex);
err = SLEEP(&softs->sl_tail, "ipl sleep");
if (err) {
@ -641,8 +607,6 @@ ipf_sync_read(softc, uio)
return EINTR;
}
MUTEX_ENTER(&softs->ipsl_mutex);
# endif /* __osf__ */
# endif /* __hpux */
# endif /* SOLARIS */
# endif /* _KERNEL */
}