aboutsummaryrefslogtreecommitdiff
path: root/contrib/ipfilter
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2019-02-03 05:25:49 +0000
committerCy Schubert <cy@FreeBSD.org>2019-02-03 05:25:49 +0000
commit0fcd8cab4e32a4899dc1c4a440ad29ba308e656d (patch)
tree9bf580f722f4a2cc2b1635c42c634c9c83c52e82 /contrib/ipfilter
parentb90dad3524185ae3e0d696da3509c31e4d9b5a93 (diff)
Notes
Diffstat (limited to 'contrib/ipfilter')
-rw-r--r--contrib/ipfilter/arc4random.c12
-rw-r--r--contrib/ipfilter/ip_dstlist.c14
-rw-r--r--contrib/ipfilter/ip_fil.c83
-rw-r--r--contrib/ipfilter/ip_fil_compat.c47
-rw-r--r--contrib/ipfilter/ipf.h20
-rw-r--r--contrib/ipfilter/ipsend/.OLD/ip_compat.h118
-rw-r--r--contrib/ipfilter/ipsend/44arp.c2
-rw-r--r--contrib/ipfilter/ipsend/arp.c2
-rw-r--r--contrib/ipfilter/ipsend/dlcommon.c4
-rw-r--r--contrib/ipfilter/ipsend/ip.c2
-rw-r--r--contrib/ipfilter/ipsend/ipresend.c10
-rw-r--r--contrib/ipfilter/ipsend/ipsend.c16
-rw-r--r--contrib/ipfilter/ipsend/ipsend.h7
-rw-r--r--contrib/ipfilter/ipsend/ipsopt.c2
-rw-r--r--contrib/ipfilter/ipsend/iptest.c13
-rw-r--r--contrib/ipfilter/ipsend/iptests.c22
-rw-r--r--contrib/ipfilter/ipsend/resend.c2
-rw-r--r--contrib/ipfilter/ipsend/sdlpi.c7
-rw-r--r--contrib/ipfilter/ipsend/sock.c4
-rw-r--r--contrib/ipfilter/lib/getifname.c3
-rw-r--r--contrib/ipfilter/lib/getproto.c8
-rw-r--r--contrib/ipfilter/lib/inet_addr.c2
-rw-r--r--contrib/ipfilter/lib/kmem.c79
-rw-r--r--contrib/ipfilter/lib/printproto.c13
-rw-r--r--contrib/ipfilter/md5.c7
-rw-r--r--contrib/ipfilter/tools/ipf.c9
-rw-r--r--contrib/ipfilter/tools/ipfs.c9
-rw-r--r--contrib/ipfilter/tools/ipfstat.c45
-rw-r--r--contrib/ipfilter/tools/ipftest.c158
-rw-r--r--contrib/ipfilter/tools/ipmon.c43
-rw-r--r--contrib/ipfilter/tools/ipnat.c16
-rw-r--r--contrib/ipfilter/tools/ipnat_y.y9
-rw-r--r--contrib/ipfilter/tools/ippool.c6
-rw-r--r--contrib/ipfilter/tools/ippool_y.y2
34 files changed, 26 insertions, 770 deletions
diff --git a/contrib/ipfilter/arc4random.c b/contrib/ipfilter/arc4random.c
index 499428702a81..bdb6b2d9ba9a 100644
--- a/contrib/ipfilter/arc4random.c
+++ b/contrib/ipfilter/arc4random.c
@@ -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"
diff --git a/contrib/ipfilter/ip_dstlist.c b/contrib/ipfilter/ip_dstlist.c
index ce2e72e8130f..99c7a22668df 100644
--- a/contrib/ipfilter/ip_dstlist.c
+++ b/contrib/ipfilter/ip_dstlist.c
@@ -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
diff --git a/contrib/ipfilter/ip_fil.c b/contrib/ipfilter/ip_fil.c
index 32cba4cdd372..794d7e205bb3 100644
--- a/contrib/ipfilter/ip_fil.c
+++ b/contrib/ipfilter/ip_fil.c
@@ -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);
diff --git a/contrib/ipfilter/ip_fil_compat.c b/contrib/ipfilter/ip_fil_compat.c
index d0b356f76904..271c2e065738 100644
--- a/contrib/ipfilter/ip_fil_compat.c
+++ b/contrib/ipfilter/ip_fil_compat.c
@@ -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
}
diff --git a/contrib/ipfilter/ipf.h b/contrib/ipfilter/ipf.h
index 695325a2788f..f5617334a0ba 100644
--- a/contrib/ipfilter/ipf.h
+++ b/contrib/ipfilter/ipf.h
@@ -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[];
diff --git a/contrib/ipfilter/ipsend/.OLD/ip_compat.h b/contrib/ipfilter/ipsend/.OLD/ip_compat.h
index b5b8f0741c25..b77cde636a98 100644
--- a/contrib/ipfilter/ipsend/.OLD/ip_compat.h
+++ b/contrib/ipfilter/ipsend/.OLD/ip_compat.h
@@ -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)
diff --git a/contrib/ipfilter/ipsend/44arp.c b/contrib/ipfilter/ipsend/44arp.c
index 9215959395ab..80521ad15084 100644
--- a/contrib/ipfilter/ipsend/44arp.c
+++ b/contrib/ipfilter/ipsend/44arp.c
@@ -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>
diff --git a/contrib/ipfilter/ipsend/arp.c b/contrib/ipfilter/ipsend/arp.c
index 58a1523e5db5..05f255ea47d2 100644
--- a/contrib/ipfilter/ipsend/arp.c
+++ b/contrib/ipfilter/ipsend/arp.c
@@ -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)
diff --git a/contrib/ipfilter/ipsend/dlcommon.c b/contrib/ipfilter/ipsend/dlcommon.c
index 55bc9423ab15..8a8cbf6a6a94 100644
--- a/contrib/ipfilter/ipsend/dlcommon.c
+++ b/contrib/ipfilter/ipsend/dlcommon.c
@@ -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>
diff --git a/contrib/ipfilter/ipsend/ip.c b/contrib/ipfilter/ipsend/ip.c
index 4f2eaed3a9b9..c1bb73f0b169 100644
--- a/contrib/ipfilter/ipsend/ip.c
+++ b/contrib/ipfilter/ipsend/ip.c
@@ -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>
diff --git a/contrib/ipfilter/ipsend/ipresend.c b/contrib/ipfilter/ipsend/ipresend.c
index 7520a0e5bf55..ea0b4211c101 100644
--- a/contrib/ipfilter/ipsend/ipresend.c
+++ b/contrib/ipfilter/ipsend/ipresend.c
@@ -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
diff --git a/contrib/ipfilter/ipsend/ipsend.c b/contrib/ipfilter/ipsend/ipsend.c
index 3df5c071e2e3..95a1bb1e5c78 100644
--- a/contrib/ipfilter/ipsend/ipsend.c
+++ b/contrib/ipfilter/ipsend/ipsend.c
@@ -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 *));
diff --git a/contrib/ipfilter/ipsend/ipsend.h b/contrib/ipfilter/ipsend/ipsend.h
index 75a0496e7f83..f409e89c656e 100644
--- a/contrib/ipfilter/ipsend/ipsend.h
+++ b/contrib/ipfilter/ipsend/ipsend.h
@@ -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));
diff --git a/contrib/ipfilter/ipsend/ipsopt.c b/contrib/ipfilter/ipsend/ipsopt.c
index a2cc4d04aad1..7f9ab5e32d79 100644
--- a/contrib/ipfilter/ipsend/ipsopt.c
+++ b/contrib/ipfilter/ipsend/ipsopt.c
@@ -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"
diff --git a/contrib/ipfilter/ipsend/iptest.c b/contrib/ipfilter/ipsend/iptest.c
index c6cfb1c75a4a..bc93106c8b89 100644
--- a/contrib/ipfilter/ipsend/iptest.c
+++ b/contrib/ipfilter/ipsend/iptest.c
@@ -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 **));
diff --git a/contrib/ipfilter/ipsend/iptests.c b/contrib/ipfilter/ipsend/iptests.c
index 0ca02db0b04d..af8772cc2097 100644
--- a/contrib/ipfilter/ipsend/iptests.c
+++ b/contrib/ipfilter/ipsend/iptests.c
@@ -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);
diff --git a/contrib/ipfilter/ipsend/resend.c b/contrib/ipfilter/ipsend/resend.c
index 8fd289ed562e..3401673ff3a1 100644
--- a/contrib/ipfilter/ipsend/resend.c
+++ b/contrib/ipfilter/ipsend/resend.c
@@ -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>
diff --git a/contrib/ipfilter/ipsend/sdlpi.c b/contrib/ipfilter/ipsend/sdlpi.c
index 1aee2e4108c6..cd540337b2fa 100644
--- a/contrib/ipfilter/ipsend/sdlpi.c
+++ b/contrib/ipfilter/ipsend/sdlpi.c
@@ -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>
diff --git a/contrib/ipfilter/ipsend/sock.c b/contrib/ipfilter/ipsend/sock.c
index d9361dcd44e0..d7eae8a13196 100644
--- a/contrib/ipfilter/ipsend/sock.c
+++ b/contrib/ipfilter/ipsend/sock.c
@@ -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>
diff --git a/contrib/ipfilter/lib/getifname.c b/contrib/ipfilter/lib/getifname.c
index 88cad329f1e3..dfba83b83c99 100644
--- a/contrib/ipfilter/lib/getifname.c
+++ b/contrib/ipfilter/lib/getifname.c
@@ -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;
diff --git a/contrib/ipfilter/lib/getproto.c b/contrib/ipfilter/lib/getproto.c
index 6c52cd3b7677..f57fe06358fb 100644
--- a/contrib/ipfilter/lib/getproto.c
+++ b/contrib/ipfilter/lib/getproto.c
@@ -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;
diff --git a/contrib/ipfilter/lib/inet_addr.c b/contrib/ipfilter/lib/inet_addr.c
index c7ae44375a5e..8667c2b33038 100644
--- a/contrib/ipfilter/lib/inet_addr.c
+++ b/contrib/ipfilter/lib/inet_addr.c
@@ -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 */
diff --git a/contrib/ipfilter/lib/kmem.c b/contrib/ipfilter/lib/kmem.c
index d895bafd0540..de97512cf5d3 100644
--- a/contrib/ipfilter/lib/kmem.c
+++ b/contrib/ipfilter/lib/kmem.c
@@ -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;
diff --git a/contrib/ipfilter/lib/printproto.c b/contrib/ipfilter/lib/printproto.c
index d411bfa00421..879da12d7857 100644
--- a/contrib/ipfilter/lib/printproto.c
+++ b/contrib/ipfilter/lib/printproto.c
@@ -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
diff --git a/contrib/ipfilter/md5.c b/contrib/ipfilter/md5.c
index 35756cdde7cc..6ac639935902 100644
--- a/contrib/ipfilter/md5.c
+++ b/contrib/ipfilter/md5.c
@@ -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"
diff --git a/contrib/ipfilter/tools/ipf.c b/contrib/ipfilter/tools/ipf.c
index 166063173b20..0551108488e0 100644
--- a/contrib/ipfilter/tools/ipf.c
+++ b/contrib/ipfilter/tools/ipf.c
@@ -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>
diff --git a/contrib/ipfilter/tools/ipfs.c b/contrib/ipfilter/tools/ipfs.c
index 43abd748f59f..7a2fe0252498 100644
--- a/contrib/ipfilter/tools/ipfs.c
+++ b/contrib/ipfilter/tools/ipfs.c
@@ -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>
diff --git a/contrib/ipfilter/tools/ipfstat.c b/contrib/ipfilter/tools/ipfstat.c
index 3f0060189f23..e18eecaabe28 100644
--- a/contrib/ipfilter/tools/ipfstat.c
+++ b/contrib/ipfilter/tools/ipfstat.c
@@ -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;
diff --git a/contrib/ipfilter/tools/ipftest.c b/contrib/ipfilter/tools/ipftest.c
index 378523d3bdf3..f9d45f71cbb2 100644
--- a/contrib/ipfilter/tools/ipftest.c
+++ b/contrib/ipfilter/tools/ipftest.c
@@ -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)
diff --git a/contrib/ipfilter/tools/ipmon.c b/contrib/ipfilter/tools/ipmon.c
index 1c52e7fd87ac..4e4d9cc28f9e 100644
--- a/contrib/ipfilter/tools/ipmon.c
+++ b/contrib/ipfilter/tools/ipmon.c
@@ -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')
diff --git a/contrib/ipfilter/tools/ipnat.c b/contrib/ipfilter/tools/ipnat.c
index c3a715698036..54a71653f3e2 100644
--- a/contrib/ipfilter/tools/ipnat.c
+++ b/contrib/ipfilter/tools/ipnat.c
@@ -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";
diff --git a/contrib/ipfilter/tools/ipnat_y.y b/contrib/ipfilter/tools/ipnat_y.y
index 39e6a92bdf67..e24641306634 100644
--- a/contrib/ipfilter/tools/ipnat_y.y
+++ b/contrib/ipfilter/tools/ipnat_y.y
@@ -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>
diff --git a/contrib/ipfilter/tools/ippool.c b/contrib/ipfilter/tools/ippool.c
index ea2ef910cb68..01d8fe236e5a 100644
--- a/contrib/ipfilter/tools/ippool.c
+++ b/contrib/ipfilter/tools/ippool.c
@@ -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"
diff --git a/contrib/ipfilter/tools/ippool_y.y b/contrib/ipfilter/tools/ippool_y.y
index 2c7574f9432d..2a9d8ee3b079 100644
--- a/contrib/ipfilter/tools/ippool_y.y
+++ b/contrib/ipfilter/tools/ippool_y.y
@@ -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>