Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/netinet Pull up revisions 1.12-1.17 (requested by m...



details:   https://anonhg.NetBSD.org/src/rev/18dcb72c0c46
branches:  netbsd-1-5
changeset: 492718:18dcb72c0c46
user:      he <he%NetBSD.org@localhost>
date:      Sat Feb 09 17:01:02 2002 +0000

description:
Pull up revisions 1.12-1.17 (requested by martti):
  Updated IPFilter to 3.4.23.

diffstat:

 sys/netinet/ip_log.c |  93 +++++++++++++++++----------------------------------
 1 files changed, 31 insertions(+), 62 deletions(-)

diffs (240 lines):

diff -r 11ef7aac545e -r 18dcb72c0c46 sys/netinet/ip_log.c
--- a/sys/netinet/ip_log.c      Sat Feb 09 17:00:41 2002 +0000
+++ b/sys/netinet/ip_log.c      Sat Feb 09 17:01:02 2002 +0000
@@ -1,20 +1,21 @@
-/*     $NetBSD: ip_log.c,v 1.10.4.1 2000/08/31 14:49:50 veego Exp $    */
+/*     $NetBSD: ip_log.c,v 1.10.4.2 2002/02/09 17:01:02 he Exp $       */
 
 /*
- * Copyright (C) 1997-2000 by Darren Reed.
+ * Copyright (C) 1997-2001 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and due credit is given
- * to the original author and the contributors.
- *
- * Id: ip_log.c,v 2.5.2.1 2000/07/19 13:11:47 darrenr Exp
+ * Id: ip_log.c,v 2.5.2.9 2001/10/30 16:48:08 darrenr Exp
  */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: ip_log.c,v 1.10.4.2 2002/02/09 17:01:02 he Exp $");
+
 #include <sys/param.h>
 #if defined(KERNEL) && !defined(_KERNEL)
 # define       _KERNEL
 #endif
-#if defined(__NetBSD__) && (NetBSD >= 199905) && !defined(IPFILTER_LKM) && \
-    !defined(_LKM)
+#if defined(__NetBSD__) && (NetBSD >= 199905) && !defined(IPFILTER_LKM)
 # include "opt_ipfilter_log.h"
 #endif
 #ifdef  __FreeBSD__
@@ -24,9 +25,13 @@
 #  endif
 # else
 #  ifdef KLD_MODULE
-#   include <sys/osreldate.h>
-#  else
-#   include <osreldate.h>
+#   ifndef __FreeBSD_cc_version
+#    include <osreldate.h>
+#   else
+#    if __FreeBSD_cc_version < 430000
+#     include <osreldate.h>
+#    endif
+#   endif
 #  endif
 # endif
 #endif
@@ -50,7 +55,7 @@
 #  include <sys/ioctl.h>
 # endif
 # include <sys/time.h>
-# if defined(_KERNEL) && !defined(linux)
+# if defined(_KERNEL)
 #  include <sys/systm.h>
 # endif
 # include <sys/uio.h>
@@ -60,9 +65,7 @@
 #  else
 #   include <sys/dir.h>
 #  endif
-#  ifndef linux
-#   include <sys/mbuf.h>
-#  endif
+#  include <sys/mbuf.h>
 # else
 #  include <sys/filio.h>
 #  include <sys/cred.h>
@@ -74,9 +77,7 @@
 #  include <sys/dditypes.h>
 #  include <sys/cmn_err.h>
 # endif
-# ifndef linux
-#  include <sys/protosw.h>
-# endif
+# include <sys/protosw.h>
 # include <sys/socket.h>
 
 # include <net/if.h>
@@ -94,7 +95,7 @@
 #   include <sys/hashing.h>
 #  endif
 # endif
-# if !defined(linux) && !(defined(__sgi) && !defined(IFF_DRVRLOCK)) /*IRIX<6*/
+# if !(defined(__sgi) && !defined(IFF_DRVRLOCK)) /*IRIX<6*/
 #  include <netinet/in_var.h>
 # endif
 # include <netinet/in_systm.h>
@@ -102,20 +103,13 @@
 # include <netinet/tcp.h>
 # include <netinet/udp.h>
 # include <netinet/ip_icmp.h>
-# ifndef linux
-#  include <netinet/ip_var.h>
-# endif
+# include <netinet/ip_var.h>
 # 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
@@ -135,9 +129,6 @@
 iplog_t        **iplh[IPL_LOGMAX+1], *iplt[IPL_LOGMAX+1], *ipll[IPL_LOGMAX+1];
 size_t iplused[IPL_LOGMAX+1];
 static fr_info_t       iplcrc[IPL_LOGMAX+1];
-# ifdef        linux
-static struct wait_queue *iplwait[IPL_LOGMAX+1];
-# endif
 
 
 /*
@@ -173,7 +164,7 @@
 mb_t *m;
 {
        ipflog_t ipfl;
-       size_t mlen, hlen;
+       register size_t mlen, hlen;
        size_t sizes[2];
        void *ptrs[2];
        int types[2];
@@ -227,16 +218,15 @@
         */
 # if SOLARIS
        ipfl.fl_unit = (u_char)ifp->ill_ppa;
-       bcopy(ifp->ill_name, ipfl.fl_ifname, MIN(ifp->ill_name_length, 4));
+       bcopy(ifp->ill_name, ipfl.fl_ifname,
+             MIN(ifp->ill_name_length, sizeof(ipfl.fl_ifname)));
        mlen = (flags & FR_LOGBODY) ? MIN(msgdsize(m) - hlen, 128) : 0;
 # else
 #  if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199603)) || \
        (defined(OpenBSD) && (OpenBSD >= 199603))
        strncpy(ipfl.fl_ifname, ifp->if_xname, IFNAMSIZ);
 #  else
-#   ifndef linux
        ipfl.fl_unit = (u_char)ifp->if_unit;
-#   endif
        if ((ipfl.fl_ifname[0] = ifp->if_name[0]))
                if ((ipfl.fl_ifname[1] = ifp->if_name[1]))
                        if ((ipfl.fl_ifname[2] = ifp->if_name[2]))
@@ -342,7 +332,7 @@
        ipl->ipl_count = 1;
        ipl->ipl_next = NULL;
        ipl->ipl_dsize = len;
-# if SOLARIS || defined(sun) || defined(linux)
+# if SOLARIS || defined(sun)
        uniqtime((struct timeval *)&ipl->ipl_sec);
 # else
 #  if BSD >= 199306 || defined(__FreeBSD__) || defined(__sgi)
@@ -375,11 +365,7 @@
        mutex_exit(&ipl_mutex);
 # else
        MUTEX_EXIT(&ipl_mutex);
-#  ifdef linux
-       wake_up_interruptible(&iplwait[dev]);
-#  else
        wakeup(&iplh[dev]);
-#  endif
 # endif
        return 1;
 }
@@ -404,8 +390,7 @@
                return ENXIO;
        if (!uio->uio_resid)
                return 0;
-       if ((uio->uio_resid < sizeof(iplog_t)) ||
-           (uio->uio_resid > IPLLOGSIZE))
+       if (uio->uio_resid < sizeof(iplog_t))
                return EINVAL;
  
        /*
@@ -422,19 +407,13 @@
                        return EINTR;
                }
 # else
-#  ifdef linux
-               interruptible_sleep_on(&iplwait[unit]);
-               if (current->signal & ~current->blocked)
-                       return -EINTR;
-#  else
                MUTEX_EXIT(&ipl_mutex);
-               SPL_X(s);
                error = SLEEP(&iplh[unit], "ipl sleep");
-               if (error)
+               if (error) {
+                       SPL_X(s);
                        return error;
-               SPL_NET(s);
+               }
                MUTEX_ENTER(&ipl_mutex);
-#  endif /* linux */
 # endif /* SOLARIS */
        }
 
@@ -452,19 +431,15 @@
                iplt[unit] = ipl->ipl_next;
                iplused[unit] -= dlen;
                MUTEX_EXIT(&ipl_mutex);
-               SPL_X(s);
                error = UIOMOVE((caddr_t)ipl, dlen, UIO_READ, uio);
+               MUTEX_ENTER(&ipl_mutex);
                if (error) {
-                       SPL_NET(s);
-                       MUTEX_ENTER(&ipl_mutex);
                        ipl->ipl_next = iplt[unit];
                        iplt[unit] = ipl;
                        iplused[unit] += dlen;
                        break;
                }
                KFREES((caddr_t)ipl, dlen);
-               SPL_NET(s);
-               MUTEX_ENTER(&ipl_mutex);
        }
        if (!iplt[unit]) {
                iplused[unit] = 0;
@@ -474,13 +449,7 @@
 
        MUTEX_EXIT(&ipl_mutex);
        SPL_X(s);
-# ifdef        linux
-       if (!error)
-               return (int)copied;
-       return -error;
-# else
        return error;
-# endif
 }
 
 



Home | Main Index | Thread Index | Old Index