Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src Pull up revision 1.8 (requested by darrenr):



details:   https://anonhg.NetBSD.org/src/rev/f8b3c357744f
branches:  netbsd-1-4
changeset: 469954:f8b3c357744f
user:      he <he%NetBSD.org@localhost>
date:      Mon Dec 20 21:08:10 1999 +0000

description:
Pull up revision 1.8 (requested by darrenr):
  Update IPF to version 3.3.5.

diffstat:

 sys/netinet/ip_log.c        |  303 ++++++++++++++++++++++---------------------
 usr.sbin/ipf/rules/Makefile |    3 +-
 2 files changed, 160 insertions(+), 146 deletions(-)

diffs (truncated from 480 to 300 lines):

diff -r 9ddf91a3b256 -r f8b3c357744f sys/netinet/ip_log.c
--- a/sys/netinet/ip_log.c      Mon Dec 20 21:08:06 1999 +0000
+++ b/sys/netinet/ip_log.c      Mon Dec 20 21:08:10 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_log.c,v 1.7 1998/12/10 15:50:59 christos Exp $      */
+/*     $NetBSD: ip_log.c,v 1.7.2.1 1999/12/20 21:08:10 he Exp $        */
 
 /*
  * Copyright (C) 1997-1998 by Darren Reed.
@@ -7,105 +7,112 @@
  * provided that this notice is preserved and due credit is given
  * to the original author and the contributors.
  *
- * Id: ip_log.c,v 2.0.2.13.2.7 1998/11/22 01:50:26 darrenr Exp 
+ * Id: ip_log.c,v 2.1.2.2 1999/09/21 11:55:44 darrenr Exp
  */
-# ifndef SOLARIS
-#  define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
-# endif
-
-# if defined(KERNEL) && !defined(_KERNEL)
-#  define       _KERNEL
-# endif
-# ifdef  __FreeBSD__
-#  if defined(_KERNEL) && !defined(IPFILTER_LKM)
-#   include <sys/osreldate.h>
-#  else
-#   include <osreldate.h>
-#  endif
-# endif
-# ifndef _KERNEL
-#  include <stdio.h>
-#  include <string.h>
-#  include <stdlib.h>
-#  include <ctype.h>
-# endif
-# include <sys/errno.h>
-# include <sys/types.h>
-# include <sys/param.h>
-# include <sys/file.h>
-# if __FreeBSD_version >= 220000 && defined(_KERNEL)
-#  include <sys/fcntl.h>
-#  include <sys/filio.h>
-# else
-#  include <sys/ioctl.h>
-# endif
-# include <sys/time.h>
-# if defined(_KERNEL) && !defined(linux)
-#  include <sys/systm.h>
-# endif
-# include <sys/uio.h>
-# if !SOLARIS
-#  if (NetBSD > 199609) || (OpenBSD > 199603)
-#   include <sys/dirent.h>
-#  else
-#   include <sys/dir.h>
-#  endif
-#  ifndef linux
-#   include <sys/mbuf.h>
+#include <sys/param.h>
+#if defined(__FreeBSD__) && defined(KERNEL) && !defined(_KERNEL)
+# define       _KERNEL
+#endif
+#ifdef  __FreeBSD__
+# if defined(_KERNEL) && !defined(IPFILTER_LKM)
+#  include <sys/osreldate.h>
+#  if defined(__FreeBSD_version) && (__FreeBSD_version >= 300000)
+#   include "opt_ipfilter.h"
 #  endif
 # else
-#  include <sys/filio.h>
-#  include <sys/cred.h>
-#  include <sys/ddi.h>
-#  include <sys/sunddi.h>
-#  include <sys/ksynch.h>
-#  include <sys/kmem.h>
-#  include <sys/mkdev.h>
-#  include <sys/dditypes.h>
-#  include <sys/cmn_err.h>
+#  include <osreldate.h>
+# endif
+#endif
+#ifndef SOLARIS
+# define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+#endif
+#ifndef _KERNEL
+# include <stdio.h>
+# include <string.h>
+# include <stdlib.h>
+# include <ctype.h>
+#endif
+#include <sys/errno.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#if __FreeBSD_version >= 220000 && defined(_KERNEL)
+# include <sys/fcntl.h>
+# include <sys/filio.h>
+#else
+# include <sys/ioctl.h>
+#endif
+#include <sys/time.h>
+#if defined(_KERNEL) && !defined(linux)
+# include <sys/systm.h>
+#endif
+#include <sys/uio.h>
+#if !SOLARIS
+# if (NetBSD > 199609) || (OpenBSD > 199603) || (__FreeBSD_version >= 300000)
+#  include <sys/dirent.h>
+# else
+#  include <sys/dir.h>
 # endif
 # ifndef linux
-#  include <sys/protosw.h>
-# endif
-# include <sys/socket.h>
-
-# include <net/if.h>
-# ifdef sun
-#  include <net/af.h>
-# endif
-# if __FreeBSD_version >= 300000
-#  include <net/if_var.h>
-# endif
-# include <net/route.h>
-# include <netinet/in.h>
-# ifdef __sgi
-#  include <sys/ddi.h>
-#  ifdef IFF_DRVRLOCK /* IRIX6 */
-#   include <sys/hashing.h>
-#  endif
+#  include <sys/mbuf.h>
 # endif
-# if !defined(linux) && !(defined(__sgi) && !defined(IFF_DRVRLOCK)) /*IRIX<6*/
-#  include <netinet/in_var.h>
-# endif
-# include <netinet/in_systm.h>
-# include <netinet/ip.h>
-# include <netinet/tcp.h>
-# include <netinet/udp.h>
-# include <netinet/ip_icmp.h>
-# ifndef linux
-#  include <netinet/ip_var.h>
+#else
+# include <sys/filio.h>
+# include <sys/cred.h>
+# include <sys/ddi.h>
+# include <sys/sunddi.h>
+# include <sys/ksynch.h>
+# include <sys/kmem.h>
+# include <sys/mkdev.h>
+# include <sys/dditypes.h>
+# include <sys/cmn_err.h>
+#endif
+#ifndef linux
+# include <sys/protosw.h>
+#endif
+#include <sys/socket.h>
+
+#include <net/if.h>
+#ifdef sun
+# include <net/af.h>
+#endif
+#if __FreeBSD_version >= 300000
+# include <net/if_var.h>
+#endif
+#include <net/route.h>
+#include <netinet/in.h>
+#ifdef __sgi
+# include <sys/ddi.h>
+# ifdef IFF_DRVRLOCK /* IRIX6 */
+#  include <sys/hashing.h>
 # endif
-# ifndef _KERNEL
-#  include <syslog.h>
-# endif
-# include "netinet/ip_compat.h"
-# include <netinet/tcpip.h>
-# include "netinet/ip_fil.h"
-# include "netinet/ip_proxy.h"
-# include "netinet/ip_nat.h"
-# include "netinet/ip_frag.h"
-# include "netinet/ip_state.h"
-# include "netinet/ip_auth.h"
+#endif
+#if !defined(linux) && !(defined(__sgi) && !defined(IFF_DRVRLOCK)) /*IRIX<6*/
+# include <netinet/in_var.h>
+#endif
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/tcp.h>
+#include <netinet/udp.h>
+#include <netinet/ip_icmp.h>
+#ifndef linux
+# include <netinet/ip_var.h>
+#endif
+#ifndef _KERNEL
+# include <syslog.h>
+#endif
+#include "netinet/ip_compat.h"
+#include <netinet/tcpip.h>
+#include "netinet/ip_fil.h"
+#include "netinet/ip_proxy.h"
+#include "netinet/ip_nat.h"
+#include "netinet/ip_frag.h"
+#include "netinet/ip_state.h"
+#include "netinet/ip_auth.h"
+#if (__FreeBSD_version >= 300000)
+# include <sys/malloc.h>
+#endif
+
+#ifdef IPFILTER_LOG
 # ifndef MIN
 #  define      MIN(a,b)        (((a)<(b))?(a):(b))
 # endif
@@ -118,14 +125,12 @@
 #  endif
 # endif
 
-#ifdef IPFILTER_LOG
-iplog_t        **iplh[IPL_LOGMAX+1], *iplt[IPL_LOGMAX+1];
-int    iplused[IPL_LOGMAX+1];
-u_long iplcrc[IPL_LOGMAX+1];
-u_long iplcrcinit;
-#ifdef linux
+iplog_t        **iplh[IPL_LOGMAX+1], *iplt[IPL_LOGMAX+1], *ipll[IPL_LOGMAX+1];
+size_t iplused[IPL_LOGMAX+1];
+fr_info_t      iplcrc[IPL_LOGMAX+1];
+# ifdef        linux
 static struct wait_queue *iplwait[IPL_LOGMAX+1];
-#endif
+# endif
 
 
 /*
@@ -134,20 +139,15 @@
  */
 void ipflog_init()
 {
-       struct  timeval tv;
        int     i;
 
        for (i = IPL_LOGMAX; i >= 0; i--) {
                iplt[i] = NULL;
+               ipll[i] = NULL;
                iplh[i] = &iplt[i];
                iplused[i] = 0;
+               bzero((char *)&iplcrc[i], sizeof(iplcrc[i]));
        }
-# if BSD >= 199306 || defined(__FreeBSD__) || defined(__sgi)
-       microtime(&tv);
-# else
-       uniqtime(&tv);
-# endif
-       iplcrcinit = tv.tv_sec ^ (tv.tv_usec << 8) ^ tv.tv_usec;
 }
 
 
@@ -166,8 +166,7 @@
 mb_t *m;
 {
        ipflog_t ipfl;
-       register int mlen, hlen;
-       u_long crc;
+       register size_t mlen, hlen;
        size_t sizes[2];
        void *ptrs[2];
        int types[2];
@@ -240,11 +239,15 @@
        ipfl.fl_hlen = (u_char)hlen;
        ipfl.fl_rule = fin->fin_rule;
        ipfl.fl_group = fin->fin_group;
+       if (fin->fin_fr != NULL)
+               ipfl.fl_loglevel = fin->fin_fr->fr_loglevel;
+       else
+               ipfl.fl_loglevel = 0xffff;
        ipfl.fl_flags = flags;
        ptrs[0] = (void *)&ipfl;
        sizes[0] = sizeof(ipfl);
        types[0] = 0;
-#if SOLARIS
+# if SOLARIS
        /*
         * Are we copied from the mblk or an aligned array ?
         */
@@ -257,45 +260,47 @@
                sizes[1] = hlen + mlen;
                types[1] = 0;
        }
-#else
+# else
        ptrs[1] = m;
        sizes[1] = hlen + mlen;
        types[1] = 1;
-#endif
-       crc = (ipf_cksum((u_short *)fin, FI_CSIZE) << 8) + iplcrcinit;
-       return ipllog(IPL_LOGIPF, crc, ptrs, sizes, types, 2);
+# endif
+       return ipllog(IPL_LOGIPF, fin, ptrs, sizes, types, 2);
 }
 



Home | Main Index | Thread Index | Old Index