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.19-1.26 (requested by m...



details:   https://anonhg.NetBSD.org/src/rev/2c4d6bbd31ba
branches:  netbsd-1-5
changeset: 492697:2c4d6bbd31ba
user:      he <he%NetBSD.org@localhost>
date:      Sat Feb 09 16:56:22 2002 +0000

description:
Pull up revisions 1.19-1.26 (requested by martti):
  Updated IPFilter to 3.4.23

diffstat:

 sys/netinet/ip_compat.h |  510 +++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 440 insertions(+), 70 deletions(-)

diffs (truncated from 717 to 300 lines):

diff -r f5e28471934a -r 2c4d6bbd31ba sys/netinet/ip_compat.h
--- a/sys/netinet/ip_compat.h   Sat Feb 09 16:56:19 2002 +0000
+++ b/sys/netinet/ip_compat.h   Sat Feb 09 16:56:22 2002 +0000
@@ -1,14 +1,12 @@
-/*     $NetBSD: ip_compat.h,v 1.18 2000/05/03 11:12:05 veego Exp $     */
+/*     $NetBSD: ip_compat.h,v 1.18.4.1 2002/02/09 16:56:22 he Exp $    */
 
 /*
- * Copyright (C) 1993-2000 by Darren Reed.
+ * Copyright (C) 1993-2001 by Darren Reed.
  *
- * 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.
+ * See the IPFILTER.LICENCE file for details on licencing.
  *
  * @(#)ip_compat.h     1.8 1/14/96
- * Id: ip_compat.h,v 2.26.2.3 2000/04/28 14:56:49 darrenr Exp
+ * Id: ip_compat.h,v 2.26.2.34 2002/01/08 14:18:13 darrenr Exp
  */
 
 #ifndef _NETINET_IP_COMPAT_H_
@@ -29,10 +27,20 @@
 #ifndef        SOLARIS
 #define        SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
 #endif
-#if SOLARIS2 >= 8
-# ifndef       USE_INET6
-#  define      USE_INET6
+#if SOLARIS
+# if !defined(SOLARIS2)
+#  define      SOLARIS2        3       /* Pick an old version */
 # endif
+# if SOLARIS2 >= 8
+#  ifndef      USE_INET6
+#   define     USE_INET6
+#  endif
+# else
+#  undef       USE_INET6
+# endif
+#endif
+#if defined(sun) && !(defined(__svr4__) || defined(__SVR4))
+# undef        USE_INET6
 #endif
 
 #if defined(_KERNEL) || defined(KERNEL) || defined(__KERNEL__)
@@ -77,12 +85,18 @@
 # endif
 #endif
 
+#ifdef __sgi
+# include      <sys/debug.h>
+#endif
+
 #ifdef linux
 # include <sys/sysmacros.h>
 #endif
 #if    SOLARIS
 # define       MTYPE(m)        ((m)->b_datap->db_type)
-# include      <sys/isa_defs.h>
+# if SOLARIS2 >= 4
+#  include     <sys/isa_defs.h>
+# endif
 # include      <sys/ioccom.h>
 # include      <sys/sysmacros.h>
 # include      <sys/kmem.h>
@@ -121,13 +135,43 @@
 #   define     V4_PART_OF_V6(v6)       v6.s6_addr32[3]
 #  endif
 # endif
-#else
+
+typedef        struct  qif     {
+       struct  qif     *qf_next;
+       ill_t   *qf_ill;
+       kmutex_t        qf_lock;
+       void    *qf_iptr;
+       void    *qf_optr;
+       queue_t *qf_in;
+       queue_t *qf_out;
+       struct  qinit   *qf_wqinfo;
+       struct  qinit   *qf_rqinfo;
+       struct  qinit   qf_wqinit;
+       struct  qinit   qf_rqinit;
+       mblk_t  *qf_m;  /* These three fields are for passing data up from */
+       queue_t *qf_q;  /* fr_qin and fr_qout to the packet processing. */
+       size_t  qf_off;
+       size_t  qf_len; /* this field is used for in ipfr_fastroute */
+       char    qf_name[8];
+       /*
+        * in case the ILL has disappeared...
+        */
+       size_t  qf_hl;  /* header length */
+       int     qf_sap;
+       size_t  qf_incnt;
+       size_t  qf_outcnt;
+} qif_t;
+#else /* SOLARIS */
 # if !defined(__sgi)
 typedef         int    minor_t;
-#endif
+# endif
 #endif /* SOLARIS */
 #define        IPMINLEN(i, h)  ((i)->ip_len >= ((i)->ip_hl * 4 + sizeof(struct h)))
 
+#if defined(__FreeBSD__) && (__FreeBSD__ >= 5) && defined(_KERNEL)
+# include <machine/in_cksum.h>
+#endif
+
 #ifndef        IP_OFFMASK
 #define        IP_OFFMASK      0x1fff
 #endif
@@ -149,8 +193,7 @@
     defined(__sgi)
 typedef u_int32_t       u_32_t;
 # if defined(_KERNEL) && !defined(IPFILTER_LKM)
-#  if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 104110000) && \
-      !defined(_LKM)
+#  if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 104110000)
 #   include "opt_inet.h"
 #  endif
 #  if defined(__FreeBSD_version) && (__FreeBSD_version >= 400000) && \
@@ -184,6 +227,7 @@
 #  endif
 typedef        struct ip6_hdr  ip6_t;
 # endif
+# include <netinet/icmp6.h>
 union  i6addr  {
        u_32_t  i6[4];
        struct  in_addr in4;
@@ -199,6 +243,14 @@
 #define        IP6CMP(a,b)     bcmp((char *)&(a), (char *)&(b), sizeof(a))
 #define        IP6EQ(a,b)      (bcmp((char *)&(a), (char *)&(b), sizeof(a)) == 0)
 #define        IP6NEQ(a,b)     (bcmp((char *)&(a), (char *)&(b), sizeof(a)) != 0)
+#define        IP6_ISZERO(a)   ((((union i6addr *)(a))->i6[0] | \
+                         ((union i6addr *)(a))->i6[1] | \
+                         ((union i6addr *)(a))->i6[2] | \
+                         ((union i6addr *)(a))->i6[3]) == 0)
+#define        IP6_NOTZERO(a)  ((((union i6addr *)(a))->i6[0] | \
+                         ((union i6addr *)(a))->i6[1] | \
+                         ((union i6addr *)(a))->i6[2] | \
+                         ((union i6addr *)(a))->i6[3]) != 0)
 
 #ifndef        MAX
 #define        MAX(a,b)        (((a) > (b)) ? (a) : (b))
@@ -262,6 +314,28 @@
 
 
 #if defined(__FreeBSD__) && (defined(KERNEL) || defined(_KERNEL))
+# ifdef IPFILTER_LKM
+#  ifndef __FreeBSD_cc_version
+#   include <osreldate.h>
+#  else
+#   if __FreeBSD_cc_version < 430000
+#    include <osreldate.h>
+#   else
+#    include <sys/param.h>
+#   endif
+#  endif
+#  define       ACTUALLY_LKM_NOT_KERNEL
+# else
+#  ifndef __FreeBSD_cc_version
+#   include <sys/osreldate.h>
+#  else
+#   if __FreeBSD_cc_version < 430000
+#    include <sys/osreldate.h>
+#   else
+#    include <sys/param.h>
+#   endif
+#  endif
+# endif
 # if __FreeBSD__ < 3
 #  include <machine/spl.h>
 # else
@@ -287,6 +361,19 @@
 # define       ATOMIC_DEC32            ATOMIC_DEC
 # define       ATOMIC_DEC16            ATOMIC_DEC
 #endif
+#ifdef __sgi
+# define  hz HZ
+# include <sys/ksynch.h>
+# define       IPF_LOCK_PL     plhi
+# include <sys/sema.h>
+#undef kmutex_t
+typedef struct {
+       lock_t *l;
+       int pl;
+} kmutex_t;
+# undef        MUTEX_INIT
+# undef        MUTEX_DESTROY
+#endif
 #ifdef KERNEL
 # if SOLARIS
 #  if SOLARIS2 >= 6
@@ -305,6 +392,7 @@
 #   define     ATOMIC_DEC32(x)         atomic_add_32((uint32_t*)&(x), -1)
 #   define     ATOMIC_DEC16(x)         atomic_add_16((uint16_t*)&(x), -1)
 #  else
+#   define     IRE_CACHE               IRE_ROUTE
 #   define     ATOMIC_INC(x)           { mutex_enter(&ipf_rw); (x)++; \
                                          mutex_exit(&ipf_rw); }
 #   define     ATOMIC_DEC(x)           { mutex_enter(&ipf_rw); (x)--; \
@@ -336,8 +424,8 @@
 #  define      MUTEX_DESTROY(x)        mutex_destroy(x)
 #  define      MUTEX_EXIT(x)   mutex_exit(x)
 #  define      MTOD(m,t)       (t)((m)->b_rptr)
-#  define      IRCOPY(a,b,c)   copyin((a), (b), (c))
-#  define      IWCOPY(a,b,c)   copyout((a), (b), (c))
+#  define      IRCOPY(a,b,c)   copyin((caddr_t)(a), (caddr_t)(b), (c))
+#  define      IWCOPY(a,b,c)   copyout((caddr_t)(a), (caddr_t)(b), (c))
 #  define      IRCOPYPTR       ircopyptr
 #  define      IWCOPYPTR       iwcopyptr
 #  define      FREE_MB_T(m)    freemsg(m)
@@ -354,43 +442,11 @@
 #  define      KMALLOC(a,b)    (a) = (b)kmem_alloc(sizeof(*(a)), KM_NOSLEEP)
 #  define      KMALLOCS(a,b,c) (a) = (b)kmem_alloc((c), KM_NOSLEEP)
 #  define      GET_MINOR(x)    getminor(x)
-typedef        struct  qif     {
-       struct  qif     *qf_next;
-       ill_t   *qf_ill;
-       kmutex_t        qf_lock;
-       void    *qf_iptr;
-       void    *qf_optr;
-       queue_t *qf_in;
-       queue_t *qf_out;
-       struct  qinit   *qf_wqinfo;
-       struct  qinit   *qf_rqinfo;
-       struct  qinit   qf_wqinit;
-       struct  qinit   qf_rqinit;
-       mblk_t  *qf_m;  /* These three fields are for passing data up from */
-       queue_t *qf_q;  /* fr_qin and fr_qout to the packet processing. */
-       size_t  qf_off;
-       size_t  qf_len; /* this field is used for in ipfr_fastroute */
-       char    qf_name[8];
-       /*
-        * in case the ILL has disappeared...
-        */
-       size_t  qf_hl;  /* header length */
-       int     qf_sap;
-} qif_t;
 extern ill_t   *get_unit __P((char *, int));
 #  define      GETUNIT(n, v)   get_unit(n, v)
 #  define      IFNAME(x)       ((ill_t *)x)->ill_name
 # else /* SOLARIS */
 #  if defined(__sgi)
-#   define  hz HZ
-#   include <sys/ksynch.h>
-#   define     IPF_LOCK_PL     plhi
-#   include <sys/sema.h>
-#undef kmutex_t
-typedef struct {
-       lock_t *l;
-       int pl;
-} kmutex_t;
 #   define     ATOMIC_INC(x)           { MUTEX_ENTER(&ipf_rw); \
                                          (x)++; MUTEX_EXIT(&ipf_rw); }
 #   define     ATOMIC_DEC(x)           { MUTEX_ENTER(&ipf_rw); \
@@ -403,8 +459,8 @@
 #   define     MUTEX_DOWNGRADE(x)      ;
 #   define     RWLOCK_EXIT(x)          MUTEX_EXIT(x)
 #   define     MUTEX_EXIT(x)           UNLOCK((x)->l, (x)->pl);
-#   define     MUTEX_INIT(x,y,z)       (x).l = LOCK_ALLOC((uchar_t)-1, IPF_LOCK_PL, (lkinfo_t *)-1, KM_NOSLEEP)
-#   define     MUTEX_DESTROY(x)        LOCK_DEALLOC((x).l)
+#   define     MUTEX_INIT(x,y,z)       (x)->l = LOCK_ALLOC((uchar_t)-1, IPF_LOCK_PL, (lkinfo_t *)-1, KM_NOSLEEP)
+#   define     MUTEX_DESTROY(x)        LOCK_DEALLOC((x)->l)
 #  else /* __sgi */
 #   define     ATOMIC_INC(x)           (x)++
 #   define     ATOMIC_DEC(x)           (x)--
@@ -441,7 +497,9 @@
         (defined(OpenBSD) && (OpenBSD >= 199603))
 #    define    IFNAME(x)       ((struct ifnet *)x)->if_xname
 #   else
-#    define    IFNAME(x)       ((struct ifnet *)x)->if_name
+#    define    USE_GETIFNAME   1
+#    define    IFNAME(x)       get_ifname((struct ifnet *)x)
+extern char    *get_ifname __P((struct ifnet *));
 #   endif
 #  endif
 # endif /* sun */
@@ -474,11 +532,19 @@
 #  define      GET_MINOR(x)    minor(x)
 # endif
 # if (BSD >= 199306) || defined(__FreeBSD__)
-#  include <vm/vm.h>
+#  if (defined(__NetBSD_Version__) && (__NetBSD_Version__ < 105180000)) || \
+       defined(__FreeBSD__) || defined(__OpenBSD__) || defined(_BSDI_VERSION)
+#   include <vm/vm.h>
+#  endif
 #  if !defined(__FreeBSD__) || (defined (__FreeBSD__) && __FreeBSD__>=3)
-#   include <vm/vm_extern.h>
+#   if (defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 105180000)) || \
+       (defined(OpenBSD) && (OpenBSD >= 200111))
+#    include <uvm/uvm_extern.h>
+#   else
+#    include <vm/vm_extern.h>
+extern vm_map_t        kmem_map;
+#   endif
 #   include <sys/proc.h>
-extern vm_map_t        kmem_map;
 #  else /* !__FreeBSD__ || (__FreeBSD__ && __FreeBSD__>=3) */



Home | Main Index | Thread Index | Old Index