svn commit: r363670 - in head/contrib/ipfilter: iplang ipsend

Cy Schubert cy at FreeBSD.org
Wed Jul 29 19:36:26 UTC 2020


Author: cy
Date: Wed Jul 29 19:36:24 2020
New Revision: 363670
URL: https://svnweb.freebsd.org/changeset/base/363670

Log:
  Continued ipfilter #ifdef cleanup. The r343701 log entry contains a
  complete description.
  
  MFC after:	1 week

Modified:
  head/contrib/ipfilter/iplang/iplang_y.y
  head/contrib/ipfilter/ipsend/arp.c
  head/contrib/ipfilter/ipsend/ipresend.c
  head/contrib/ipfilter/ipsend/ipsend.c
  head/contrib/ipfilter/ipsend/iptest.c
  head/contrib/ipfilter/ipsend/iptests.c
  head/contrib/ipfilter/ipsend/sock.c

Modified: head/contrib/ipfilter/iplang/iplang_y.y
==============================================================================
--- head/contrib/ipfilter/iplang/iplang_y.y	Wed Jul 29 19:22:50 2020	(r363669)
+++ head/contrib/ipfilter/iplang/iplang_y.y	Wed Jul 29 19:36:24 2020	(r363670)
@@ -45,11 +45,6 @@
 #include "ipf.h"
 #include "iplang.h"
 
-#if !defined(__NetBSD__) && (!defined(__FreeBSD_version) && \
-    __FreeBSD_version < 400020) && (!SOLARIS || SOLARIS2 < 10)
-extern	struct ether_addr *ether_aton __P((char *));
-#endif
-
 extern	int	opts;
 extern	struct ipopt_names ionames[];
 extern	int	state, state, lineNum, token;
@@ -58,11 +53,7 @@ extern	char	yytext[];
 extern	FILE	*yyin;
 int	yylex	__P((void));
 #define	YYDEBUG 1
-#if !defined(ultrix) && !defined(hpux)
 int	yydebug = 1;
-#else
-extern	int	yydebug;
-#endif
 
 iface_t *iflist = NULL, **iftail = &iflist;
 iface_t *cifp = NULL;

Modified: head/contrib/ipfilter/ipsend/arp.c
==============================================================================
--- head/contrib/ipfilter/ipsend/arp.c	Wed Jul 29 19:22:50 2020	(r363669)
+++ head/contrib/ipfilter/ipsend/arp.c	Wed Jul 29 19:36:24 2020	(r363670)
@@ -11,17 +11,13 @@ static const char rcsid[] = "@(#)$Id$";
 #endif
 #include <sys/types.h>
 #include <sys/socket.h>
-#if !defined(ultrix) && !defined(hpux) && !defined(__hpux) && !defined(__osf__) && !defined(_AIX51)
 # include <sys/sockio.h>
-#endif
 #include <sys/ioctl.h>
 #include <netinet/in_systm.h>
 #include <netinet/in.h>
 #include <net/if.h>
 #include <netinet/if_ether.h>
-#ifndef	ultrix
 # include <net/if_arp.h>
-#endif
 #include <netinet/in.h>
 #include <netinet/ip.h>
 #include <netinet/ip_var.h>

Modified: head/contrib/ipfilter/ipsend/ipresend.c
==============================================================================
--- head/contrib/ipfilter/ipsend/ipresend.c	Wed Jul 29 19:22:50 2020	(r363669)
+++ head/contrib/ipfilter/ipsend/ipresend.c	Wed Jul 29 19:36:24 2020	(r363670)
@@ -38,15 +38,7 @@ int	opts = 0;
 #  ifdef	sun
 char	default_device[] = "le0";
 #  else
-#   ifdef	ultrix
-char	default_device[] = "ln0";
-#   else
-#    ifdef	__bsdi__
-char	default_device[] = "ef0";
-#    else
 char	default_device[] = "lan0";
-#    endif
-#   endif
 #  endif
 #else
 char	default_device[] = DEFAULT_DEVICE;

Modified: head/contrib/ipfilter/ipsend/ipsend.c
==============================================================================
--- head/contrib/ipfilter/ipsend/ipsend.c	Wed Jul 29 19:22:50 2020	(r363669)
+++ head/contrib/ipfilter/ipsend/ipsend.c	Wed Jul 29 19:36:24 2020	(r363670)
@@ -33,15 +33,7 @@ extern	void	iplang __P((FILE *));
 
 char	options[68];
 int	opts;
-# ifdef ultrix
-char	default_device[] = "ln0";
-# else
-#  ifdef __bsdi__
-char	default_device[] = "ef0";
-#  else
 char	default_device[] = "le0";
-#  endif /* __bsdi__ */
-# endif /* ultrix */
 
 
 static	void	usage __P((char *));

Modified: head/contrib/ipfilter/ipsend/iptest.c
==============================================================================
--- head/contrib/ipfilter/ipsend/iptest.c	Wed Jul 29 19:22:50 2020	(r363669)
+++ head/contrib/ipfilter/ipsend/iptest.c	Wed Jul 29 19:36:24 2020	(r363670)
@@ -34,15 +34,7 @@ char	options[68];
 # ifdef	sun
 char	default_device[] = "le0";
 # else
-#  ifdef	ultrix
-char	default_device[] = "ln0";
-#  else
-#   ifdef	__bsdi__
-char	default_device[] = "ef0";
-#   else
 char	default_device[] = "lan0";
-#   endif
-#  endif
 # endif
 
 static	void	usage __P((char *));

Modified: head/contrib/ipfilter/ipsend/iptests.c
==============================================================================
--- head/contrib/ipfilter/ipsend/iptests.c	Wed Jul 29 19:22:50 2020	(r363669)
+++ head/contrib/ipfilter/ipsend/iptests.c	Wed Jul 29 19:36:24 2020	(r363670)
@@ -36,18 +36,13 @@ typedef	int	boolean_t;
 # endif
 # undef  _KERNEL
 # undef  KERNEL
-#if !defined(solaris) && !defined(linux) && !defined(__sgi)
+#if !defined(solaris)
 # include <nlist.h>
 # include <sys/user.h>
 # include <sys/proc.h>
 #endif
-#if !defined(ultrix) && !defined(hpux) && !defined(linux) && \
-    !defined(__sgi) && !defined(__osf__) && !defined(_AIX51)
 # include <kvm.h>
-#endif
-#ifndef	ultrix
 # include <sys/socket.h>
-#endif
 #if defined(solaris)
 # include <sys/stream.h>
 #else
@@ -57,11 +52,9 @@ typedef	int	boolean_t;
 #include <sys/systm.h>
 #include <sys/session.h>
 #endif
-#if BSD >= 199103
 # include <sys/sysctl.h>
 # include <sys/filedesc.h>
 # include <paths.h>
-#endif
 #include <netinet/in_systm.h>
 #include <sys/socket.h>
 #include <net/if.h>
@@ -74,7 +67,7 @@ typedef	int	boolean_t;
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netinet/ip.h>
-#if defined(__SVR4) || defined(__svr4__) || defined(__sgi)
+#if defined(__SVR4) || defined(__svr4__)
 # include <sys/sysmacros.h>
 #endif
 #include <stdio.h>
@@ -82,7 +75,7 @@ typedef	int	boolean_t;
 #include <stdlib.h>
 #include <string.h>
 # include <netinet/ip_var.h>
-# if !defined(__hpux) && !defined(solaris)
+# if !defined(solaris)
 #  include <netinet/in_pcb.h>
 # endif
 #include "ipsend.h"

Modified: head/contrib/ipfilter/ipsend/sock.c
==============================================================================
--- head/contrib/ipfilter/ipsend/sock.c	Wed Jul 29 19:22:50 2020	(r363669)
+++ head/contrib/ipfilter/ipsend/sock.c	Wed Jul 29 19:36:24 2020	(r363670)
@@ -21,14 +21,8 @@ static const char rcsid[] = "@(#)$Id$";
  */
 typedef int     boolean_t;
 #endif
-#ifndef	ultrix
 #include <fcntl.h>
-#endif
-#if (__FreeBSD_version >= 300000)
 # include <sys/dirent.h>
-#else
-# include <sys/dir.h>
-#endif
 # ifdef __NetBSD__
 #  include <machine/lock.h>
 # endif
@@ -38,10 +32,6 @@ typedef int     boolean_t;
 #  define _KERNEL
 #  define	KERNEL
 # endif
-# ifdef	ultrix
-#  undef	LOCORE
-#  include <sys/smp_lock.h>
-# endif
 # include <sys/file.h>
 # ifdef __FreeBSD__
 #  undef _WANT_FILE
@@ -54,18 +44,14 @@ typedef int     boolean_t;
 #include <sys/socket.h>
 #include <sys/socketvar.h>
 #include <sys/proc.h>
-#if !defined(ultrix) && !defined(hpux) && !defined(__osf__)
 # include <kvm.h>
-#endif
 #ifdef sun
 #include <sys/systm.h>
 #include <sys/session.h>
 #endif
-#if BSD >= 199103
 #include <sys/sysctl.h>
 #include <sys/filedesc.h>
 #include <paths.h>
-#endif
 #include <math.h>
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
@@ -143,128 +129,10 @@ int	kmemcpy(buf, pos, n)
 struct	nlist	names[4] = {
 	{ "_proc" },
 	{ "_nproc" },
-#ifdef	ultrix
-	{ "_u" },
-#else
 	{ NULL },
-#endif
 	{ NULL }
 	};
 
-#if BSD < 199103
-static struct proc *getproc()
-{
-	struct	proc	*p;
-	pid_t	pid = getpid();
-	int	siz, n;
-
-	n = nlist(KERNEL, names);
-	if (n != 0)
-	    {
-		fprintf(stderr, "nlist(%#x) == %d\n", names, n);
-		return NULL;
-	    }
-	if (KMCPY(&nproc, names[1].n_value, sizeof(nproc)) == -1)
-	    {
-		fprintf(stderr, "read nproc (%#x)\n", names[1].n_value);
-		return NULL;
-	    }
-	siz = nproc * sizeof(struct proc);
-	if (KMCPY(&p, names[0].n_value, sizeof(p)) == -1)
-	    {
-		fprintf(stderr, "read(%#x,%#x,%d) proc\n",
-			names[0].n_value, &p, sizeof(p));
-		return NULL;
-	    }
-	proc = (struct proc *)malloc(siz);
-	if (KMCPY(proc, p, siz) == -1)
-	    {
-		fprintf(stderr, "read(%#x,%#x,%d) proc\n",
-			p, proc, siz);
-		return NULL;
-	    }
-
-	p = proc;
-
-	for (n = nproc; n; n--, p++)
-		if (p->p_pid == pid)
-			break;
-	if (!n)
-		return NULL;
-
-	return p;
-}
-
-
-struct	tcpcb	*find_tcp(fd, ti)
-	int	fd;
-	struct	tcpiphdr *ti;
-{
-	struct	tcpcb	*t;
-	struct	inpcb	*i;
-	struct	socket	*s;
-	struct	user	*up;
-	struct	proc	*p;
-	struct	file	*f, **o;
-
-	if (!(p = getproc()))
-		return NULL;
-	up = (struct user *)malloc(sizeof(*up));
-#ifndef	ultrix
-	if (KMCPY(up, p->p_uarea, sizeof(*up)) == -1)
-	    {
-		fprintf(stderr, "read(%#x,%#x) failed\n", p, p->p_uarea);
-		return NULL;
-	    }
-#else
-	if (KMCPY(up, names[2].n_value, sizeof(*up)) == -1)
-	    {
-		fprintf(stderr, "read(%#x,%#x) failed\n", p, names[2].n_value);
-		return NULL;
-	    }
-#endif
-
-	o = (struct file **)calloc(up->u_lastfile + 1, sizeof(*o));
-	if (KMCPY(o, up->u_ofile, (up->u_lastfile + 1) * sizeof(*o)) == -1)
-	    {
-		fprintf(stderr, "read(%#x,%#x,%d) - u_ofile - failed\n",
-			up->u_ofile, o, sizeof(*o));
-		return NULL;
-	    }
-	f = (struct file *)calloc(1, sizeof(*f));
-	if (KMCPY(f, o[fd], sizeof(*f)) == -1)
-	    {
-		fprintf(stderr, "read(%#x,%#x,%d) - o[fd] - failed\n",
-			up->u_ofile[fd], f, sizeof(*f));
-		return NULL;
-	    }
-
-	s = (struct socket *)calloc(1, sizeof(*s));
-	if (KMCPY(s, f->f_data, sizeof(*s)) == -1)
-	    {
-		fprintf(stderr, "read(%#x,%#x,%d) - f_data - failed\n",
-			o[fd], s, sizeof(*s));
-		return NULL;
-	    }
-
-	i = (struct inpcb *)calloc(1, sizeof(*i));
-	if (KMCPY(i, s->so_pcb, sizeof(*i)) == -1)
-	    {
-		fprintf(stderr, "kvm_read(%#x,%#x,%d) - so_pcb - failed\n",
-			s->so_pcb, i, sizeof(*i));
-		return NULL;
-	    }
-
-	t = (struct tcpcb *)calloc(1, sizeof(*t));
-	if (KMCPY(t, i->inp_ppcb, sizeof(*t)) == -1)
-	    {
-		fprintf(stderr, "read(%#x,%#x,%d) - inp_ppcb - failed\n",
-			i->inp_ppcb, t, sizeof(*t));
-		return NULL;
-	    }
-	return (struct tcpcb *)i->inp_ppcb;
-}
-#else
 static struct kinfo_proc *getproc()
 {
 	static	struct	kinfo_proc kp;
@@ -304,7 +172,7 @@ struct	tcpcb	*find_tcp(tfd, ti)
 	fd = (struct filedesc *)malloc(sizeof(*fd));
 	if (fd == NULL)
 		return NULL;
-#if defined( __FreeBSD_version) && __FreeBSD_version >= 500013
+#if defined( __FreeBSD_version)
 	if (KMCPY(fd, p->ki_fd, sizeof(*fd)) == -1)
 	    {
 		fprintf(stderr, "read(%#lx,%#lx) failed\n",
@@ -381,7 +249,6 @@ finderror:
 		free(t);
 	return NULL;
 }
-#endif /* BSD < 199301 */
 
 int	do_socket(dev, mtu, ti, gwip)
 	char	*dev;


More information about the svn-src-all mailing list