Source-Changes-HG archive

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

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



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

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

diffstat:

 sys/netinet/ip_compat.h |  77 +++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 62 insertions(+), 15 deletions(-)

diffs (227 lines):

diff -r 2cd73509856f -r e88cebab0982 sys/netinet/ip_compat.h
--- a/sys/netinet/ip_compat.h   Mon Dec 20 21:07:16 1999 +0000
+++ b/sys/netinet/ip_compat.h   Mon Dec 20 21:07:21 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_compat.h,v 1.16 1998/11/22 15:17:19 mrg Exp $       */
+/*     $NetBSD: ip_compat.h,v 1.16.4.1 1999/12/20 21:07:21 he Exp $    */
 
 /*
  * Copyright (C) 1993-1998 by Darren Reed.
@@ -8,7 +8,7 @@
  * to the original author and the contributors.
  *
  * @(#)ip_compat.h     1.8 1/14/96
- * Id: ip_compat.h,v 2.0.2.31.2.20 1998/11/22 01:50:20 darrenr Exp 
+ * Id: ip_compat.h,v 2.1.2.3 1999/11/18 13:55:26 darrenr Exp
  */
 
 #ifndef _NETINET_IP_COMPAT_H_
@@ -19,9 +19,12 @@
 #  define      __P(x)  x
 # else
 #  define      __P(x)  ()
-#  define      const
 # endif
 #endif
+#ifndef        __STDC__
+# undef                const
+# define       const
+#endif
 
 #ifndef        SOLARIS
 #define        SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
@@ -74,6 +77,7 @@
 #endif
 #if    SOLARIS
 # define       MTYPE(m)        ((m)->b_datap->db_type)
+# include      <sys/isa_defs.h>
 # include      <sys/ioccom.h>
 # include      <sys/sysmacros.h>
 # include      <sys/kmem.h>
@@ -97,6 +101,15 @@
 #  include <inet/ip.h>
 #  include <inet/ip_ire.h>
 # endif /* _KERNEL */
+# if SOLARIS2 >= 8
+#  include <netinet/ip6.h>
+#  include <inet/ip6.h>
+#  define      ipif_local_addr ipif_lcl_addr
+# endif
+#else
+# if !defined(__sgi)
+typedef         int    minor_t;
+#endif
 #endif /* SOLARIS */
 #define        IPMINLEN(i, h)  ((i)->ip_len >= ((i)->ip_hl * 4 + sizeof(struct h)))
 
@@ -123,7 +136,7 @@
 /*
  * Really, any arch where sizeof(long) != sizeof(int).
  */
-# if defined(__alpha__) || defined(__alpha)
+# if defined(__alpha__) || defined(__alpha) || defined(_LP64)
 typedef unsigned int    u_32_t;
 # else
 typedef unsigned long   u_32_t;
@@ -215,6 +228,10 @@
 #   define     KRWLOCK_T               krwlock_t
 #   define     READ_ENTER(x)           rw_enter(x, RW_READER)
 #   define     WRITE_ENTER(x)          rw_enter(x, RW_WRITER)
+#   define     RW_UPGRADE(x)           { if (rw_tryupgrade(x) == 0) { \
+                                             rw_exit(x); \
+                                             rw_enter(x, RW_WRITER); } \
+                                       }
 #   define     MUTEX_DOWNGRADE(x)      rw_downgrade(x)
 #   define     RWLOCK_INIT(x, y, z)    rw_init((x), (y), RW_DRIVER, (z))
 #   define     RWLOCK_EXIT(x)          rw_exit(x)
@@ -243,7 +260,8 @@
 #   define     htons(x)        (x)
 #   define     htonl(x)        (x)
 #  endif /* sparc */
-#  define      KMALLOC(a,b,c)  (a) = (b)kmem_alloc((c), KM_NOSLEEP)
+#  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;
@@ -259,18 +277,19 @@
        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. */
-       int     qf_off;
-       int     qf_len; /* this field is used for in ipfr_fastroute */
+       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...
         */
-       int     qf_hl;  /* header length */
+       size_t  qf_hl;  /* header length */
 } qif_t;
 extern ill_t   *get_unit __P((char *));
 #  define      GETUNIT(n)      get_unit((n))
 # else /* SOLARIS */
 #  if defined(__sgi)
+#   define  hz HZ
 #   include <sys/ksynch.h>
 #   define     IPF_LOCK_PL     plhi
 #   include <sys/sema.h>
@@ -287,6 +306,7 @@
 #   define     KRWLOCK_T               kmutex_t
 #   define     READ_ENTER(x)           MUTEX_ENTER(x)
 #   define     WRITE_ENTER(x)          MUTEX_ENTER(x)
+#   define     RW_UPGRADE(x)           ;
 #   define     MUTEX_DOWNGRADE(x)      ;
 #   define     RWLOCK_EXIT(x)  MUTEX_EXIT(x)
 #   define     MUTEX_EXIT(x)   UNLOCK((x)->l, (x)->pl);
@@ -296,6 +316,7 @@
 #   define     MUTEX_ENTER(x)          ;
 #   define     READ_ENTER(x)   ;
 #   define     WRITE_ENTER(x)  ;
+#   define     RW_UPGRADE(x)   ;
 #   define     MUTEX_DOWNGRADE(x)      ;
 #   define     RWLOCK_EXIT(x)  ;
 #   define     MUTEX_EXIT(x)   ;
@@ -332,11 +353,14 @@
 #  ifdef __sgi
 #   include <sys/kmem.h>
 #   include <sys/ddi.h>
-#   define     KMALLOC(a,b,c)  (a) = (b)kmem_alloc((c), KM_NOSLEEP)
+#   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)
 #  else
 #   if !SOLARIS
-#    define    KMALLOC(a,b,c)  (a) = (b)new_kmem_alloc((c), KMEM_NOSLEEP)
+#    define    KMALLOC(a,b)    (a) = (b)new_kmem_alloc(sizeof(*(a)), \
+                                                       KMEM_NOSLEEP)
+#    define    KMALLOCS(a,b,c) (a) = (b)new_kmem_alloc((c), KMEM_NOSLEEP)
 #   endif /* SOLARIS */
 #  endif /* __sgi */
 # endif /* sun && !linux */
@@ -353,11 +377,13 @@
 #   include <vm/vm_kern.h>
 #  endif /* !__FreeBSD__ || (__FreeBSD__ && __FreeBSD__>=3) */
 #  ifdef       M_PFIL
-#   define     KMALLOC(a, b, c)        MALLOC((a), b, (c), M_PFIL, M_NOWAIT)
+#   define     KMALLOC(a, b)   MALLOC((a), b, sizeof(*(a)), M_PFIL, M_NOWAIT)
+#   define     KMALLOCS(a, b, c)       MALLOC((a), b, (c), M_PFIL, M_NOWAIT)
 #   define     KFREE(x)        FREE((x), M_PFIL)
 #   define     KFREES(x,s)     FREE((x), M_PFIL)
 #  else
-#   define     KMALLOC(a, b, c)        MALLOC((a), b, (c), M_TEMP, M_NOWAIT)
+#   define     KMALLOC(a, b)   MALLOC((a), b, sizeof(*(a)), M_TEMP, M_NOWAIT)
+#   define     KMALLOCS(a, b, c)       MALLOC((a), b, (c), M_TEMP, M_NOWAIT)
 #   define     KFREE(x)        FREE((x), M_TEMP)
 #   define     KFREES(x,s)     FREE((x), M_TEMP)
 #  endif /* M_PFIL */
@@ -385,6 +411,7 @@
 # define       MUTEX_ENTER(x)  ;
 # define       READ_ENTER(x)   ;
 # define       WRITE_ENTER(x)  ;
+# define       RW_UPGRADE(x)   ;
 # define       MUTEX_DOWNGRADE(x)      ;
 # define       RWLOCK_EXIT(x)  ;
 # define       MUTEX_EXIT(x)   ;
@@ -392,7 +419,8 @@
 # define       SPL_IMP(x)      ;
 # undef                SPL_X
 # define       SPL_X(x)        ;
-# define       KMALLOC(a,b,c)  (a) = (b)malloc(c)
+# define       KMALLOC(a,b)    (a) = (b)malloc(sizeof(*a))
+# define       KMALLOCS(a,b,c) (a) = (b)malloc(c)
 # define       KFREE(x)        free(x)
 # define       KFREES(x,s)     free(x)
 # define       GETUNIT(x)      get_unit(x)
@@ -402,6 +430,15 @@
 
 #if SOLARIS
 typedef mblk_t mb_t;
+# if SOLARIS2 >= 7
+#  ifdef lint
+#   define ALIGN32(ptr)    (ptr ? 0L : 0L)
+#   define ALIGN16(ptr)    (ptr ? 0L : 0L)
+#  else
+#   define ALIGN32(ptr)    (ptr)
+#   define ALIGN16(ptr)    (ptr)
+#  endif
+# endif
 #else
 # ifdef        linux
 #  ifndef kernel
@@ -620,8 +657,8 @@
        __u8    ip_hl:4;
        __u8    ip_v:4;
 # else
+       __u8    ip_v:4;
        __u8    ip_hl:4;
-       __u8    ip_v:4;
 # endif
        __u8    ip_tos;
        __u16   ip_len;
@@ -728,7 +765,8 @@
 
 #  define      UNITNAME(n)     dev_get((n))
 
-#  define      KMALLOC(a,b,c)  (a) = (b)kmalloc((c), GFP_ATOMIC)
+#  define      KMALLOC(a,b)    (a) = (b)kmalloc(sizeof(*(a)), GFP_ATOMIC)
+#  define      KMALLOCS(a,b,c) (a) = (b)kmalloc((c), GFP_ATOMIC)
 #  define      KFREE(x)        kfree_s((x), sizeof(*(x)))
 #  define      KFREES(x,s)     kfree_s((x), (s))
 #  define      IRCOPY(a,b,c)   { \
@@ -787,5 +825,14 @@
 #ifndef        ICMP_ROUTERSOLICIT
 # define       ICMP_ROUTERSOLICIT      10
 #endif
+/*
+ * ICMP error replies have an IP header (20 bytes), 8 bytes of ICMP data,
+ * another IP header and then 64 bits of data, totalling 56.  Of course,
+ * the last 64 bits is dependant on that being available.
+ */
+#define        ICMPERR_ICMPHLEN        8
+#define        ICMPERR_IPICMPHLEN      (20 + 8)
+#define        ICMPERR_MINPKTLEN       (20 + 8 + 20)
+#define        ICMPERR_MAXPKTLEN       (20 + 8 + 20 + 8)
 
 #endif /* _NETINET_IP_COMPAT_H_ */



Home | Main Index | Thread Index | Old Index