Source-Changes-HG archive

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

[src/trunk]: src/sys IPv6 kernel code, based on KAME/NetBSD 1.4, SNAP kit 199...



details:   https://anonhg.NetBSD.org/src/rev/04cd0b816ba9
branches:  trunk
changeset: 474194:04cd0b816ba9
user:      itojun <itojun%NetBSD.org@localhost>
date:      Thu Jul 01 08:12:45 1999 +0000

description:
IPv6 kernel code, based on KAME/NetBSD 1.4, SNAP kit 19990628.
(Sorry for a big commit, I can't separate this into several pieces...)
Pls check sys/netinet6/TODO and sys/netinet6/IMPLEMENTATION for details.

- sys/kern: do not assume single mbuf, accept chained mbuf on passing
  data from userland to kernel (or other way round).
- "midway" ATM card: ATM PVC pseudo device support, like those done in ALTQ
  package (ftp://ftp.csl.sony.co.jp/pub/kjc/).
- sys/netinet/tcp*: IPv4/v6 dual stack tcp support.
- sys/netinet/{ip6,icmp6}.h, sys/net/pfkeyv2.h: IETF document assumes those
  file to be there so we patch it up.
- sys/netinet: IPsec additions are here and there.
- sys/netinet6/*: most of IPv6 code sits here.
- sys/netkey: IPsec key management code
- dev/pci/pcidevs: regen

In my understanding no code here is subject to export control so it
should be safe.

diffstat:

 sys/Makefile                |     5 +-
 sys/conf/files              |    60 +-
 sys/dev/ic/midway.c         |   860 +++++++++++++++++++++++++-
 sys/dev/ic/midwayreg.h      |     3 +-
 sys/dev/ic/midwayvar.h      |    22 +-
 sys/dev/pci/if_en_pci.c     |   150 ++++-
 sys/dev/pci/pcidevs.h       |     8 +-
 sys/dev/pci/pcidevs_data.h  |     4 +-
 sys/kern/uipc_domain.c      |    40 +-
 sys/kern/uipc_socket2.c     |    14 +-
 sys/kern/uipc_syscalls.c    |    24 +-
 sys/net/Makefile            |     3 +-
 sys/net/if.c                |   175 ++++-
 sys/net/if.h                |    47 +-
 sys/net/if_atm.h            |    57 +-
 sys/net/if_atmsubr.c        |    68 ++-
 sys/net/if_ether.h          |    18 +-
 sys/net/if_ethersubr.c      |   105 +++-
 sys/net/if_fddisubr.c       |    55 +-
 sys/net/if_loop.c           |    93 ++-
 sys/net/if_ppp.c            |     8 +-
 sys/net/if_tun.c            |    10 +-
 sys/net/if_types.h          |     7 +-
 sys/net/netisr.h            |     3 +-
 sys/net/ppp_defs.h          |     3 +-
 sys/net/route.c             |    52 +-
 sys/net/route.h             |     6 +-
 sys/net/rtsock.c            |   148 +++-
 sys/netccitt/if_x25subr.c   |     6 +-
 sys/netinet/Makefile        |     4 +-
 sys/netinet/if_atm.c        |     4 +-
 sys/netinet/igmp.c          |    39 +-
 sys/netinet/in.c            |   291 ++++++++-
 sys/netinet/in.h            |    57 +-
 sys/netinet/in_pcb.c        |   137 ++++-
 sys/netinet/in_pcb.h        |    41 +-
 sys/netinet/in_proto.c      |    87 ++-
 sys/netinet/in_var.h        |     8 +-
 sys/netinet/ip.h            |     7 +-
 sys/netinet/ip_ecn.c        |     2 +-
 sys/netinet/ip_ecn.h        |     2 +-
 sys/netinet/ip_icmp.c       |   103 +++-
 sys/netinet/ip_input.c      |   183 ++++-
 sys/netinet/ip_mroute.c     |    10 +-
 sys/netinet/ip_mroute.h     |     5 +-
 sys/netinet/ip_output.c     |   223 ++++++-
 sys/netinet/ip_var.h        |     4 +-
 sys/netinet/raw_ip.c        |    53 +-
 sys/netinet/tcp_debug.c     |    97 ++-
 sys/netinet/tcp_debug.h     |    11 +-
 sys/netinet/tcp_input.c     |  1395 ++++++++++++++++++++++++++++++++----------
 sys/netinet/tcp_output.c    |   463 ++++++++++++-
 sys/netinet/tcp_subr.c      |   766 ++++++++++++++++++++---
 sys/netinet/tcp_timer.c     |   121 +++-
 sys/netinet/tcp_usrreq.c    |   329 +++++++++-
 sys/netinet/tcp_var.h       |   128 +++-
 sys/netinet/udp_usrreq.c    |   140 +++-
 sys/netinet6/IMPLEMENTATION |  1043 ++++++++++++++++++++++++++++++++
 sys/netinet6/Makefile       |     5 +-
 sys/netinet6/TODO           |   138 ++++
 sys/netinet6/ah_core.c      |     2 +
 sys/netinet6/esp.h          |   105 +++
 sys/netinet6/in6.c          |   146 ----
 sys/netinet6/in6.h          |    49 +-
 sys/netinet6/in6_ifattach.c |     2 -
 sys/netinet6/in6_pcb.c      |     4 -
 sys/netinet6/in6_pcb.h      |     4 -
 sys/netinet6/in6_proto.c    |    24 +-
 sys/netinet6/ip6_input.c    |     9 -
 sys/netinet6/ip6_var.h      |     3 -
 sys/netinet6/ipsec.c        |    11 +-
 sys/netinet6/ipsec.h        |     2 +-
 sys/netinet6/pim6_var.h     |     2 +-
 sys/netinet6/udp6_usrreq.c  |   282 +--------
 sys/netiso/if_eon.c         |     9 +-
 sys/netkey/Makefile         |     2 +-
 sys/netkey/key.c            |     4 +-
 sys/netkey/key.h            |     2 +-
 sys/netkey/key_debug.c      |     2 +-
 sys/netkey/key_debug.h      |     2 +-
 sys/netkey/keysock.c        |     2 +-
 sys/netkey/keysock.h        |     2 +-
 sys/netkey/keyv2.h          |     2 +-
 sys/sys/malloc.h            |    12 +-
 sys/sys/mbuf.h              |    16 +-
 sys/sys/socket.h            |    69 ++-
 sys/sys/sockio.h            |    10 +-
 87 files changed, 7407 insertions(+), 1322 deletions(-)

diffs (truncated from 13183 to 300 lines):

diff -r 93565cc4759d -r 04cd0b816ba9 sys/Makefile
--- a/sys/Makefile      Thu Jul 01 07:59:57 1999 +0000
+++ b/sys/Makefile      Thu Jul 01 08:12:45 1999 +0000
@@ -1,7 +1,8 @@
-#      $NetBSD: Makefile,v 1.35 1999/05/17 16:41:48 kleink Exp $
+#      $NetBSD: Makefile,v 1.36 1999/07/01 08:12:45 itojun Exp $
 
 SUBDIR=        adosfs arch compat dev filecorefs isofs miscfs msdosfs net \
-       netatalk netccitt netinet netiso netnatm netns nfs ntfs sys ufs uvm vm
+       netatalk netccitt netinet netinet6 netiso netkey netnatm netns \
+       nfs ntfs sys ufs uvm vm
 
 .if (${MACHINE_ARCH} != "powerpc" && \
     ${MACHINE_ARCH} != "mipseb" && ${MACHINE_ARCH} != "mipsel")
diff -r 93565cc4759d -r 04cd0b816ba9 sys/conf/files
--- a/sys/conf/files    Thu Jul 01 07:59:57 1999 +0000
+++ b/sys/conf/files    Thu Jul 01 08:12:45 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files,v 1.293 1999/06/27 12:43:08 pk Exp $
+#      $NetBSD: files,v 1.294 1999/07/01 08:12:45 itojun Exp $
 
 #      @(#)files.newconf       7.5 (Berkeley) 5/10/93
 
@@ -152,6 +152,7 @@
 define hippi
 define token
 define sppp
+define crypto
 
 # devices ARPing IPv4 pull this in:
 define arp
@@ -419,6 +420,8 @@
 pseudo-device ipfilter: ifnet
 pseudo-device ipip: ifnet
 pseudo-device gre: ifnet
+pseudo-device gif: ifnet
+pseudo-device faith: ifnet
 
 pseudo-device sequencer
 
@@ -542,6 +545,59 @@
 file kern/exec_aout.c                  exec_aout
 file kern/exec_conf.c
 file kern/exec_ecoff.c                 exec_ecoff
+
+file netkey/key.c                      ipsec
+file netkey/key_debug.c                        ipsec
+file netkey/keysock.c                  ipsec
+
+# inet6 stuff
+file net/if_faith.c                    faith                   needs-count
+file net/if_gif.c                      gif                     needs-count
+file netinet/ip_ecn.c                  inet | inet6
+file netinet/in_gif.c                  gif & inet
+file netinet6/in6_gif.c                        gif & inet6
+file netinet6/in6.c                    inet6
+file netinet6/in6_ifattach.c           inet6
+file netinet6/in6_cksum.c              inet6
+file netinet6/in6_pcb.c                        inet6
+file netinet6/in6_prefix.c             inet6
+file netinet6/in6_proto.c              inet6
+file netinet6/dest6.c                  inet6
+file netinet6/frag6.c                  inet6
+file netinet6/icmp6.c                  inet6
+file netinet6/ip6_input.c              inet6
+file netinet6/ip6_forward.c            inet6
+file netinet6/ip6_mroute.c             inet6
+file netinet6/ip6_output.c             inet6
+file netinet6/route6.c                 inet6
+file netinet6/mld6.c                   inet6
+file netinet6/nd6.c                    inet6
+file netinet6/nd6_nbr.c                        inet6
+file netinet6/nd6_rtr.c                        inet6
+file netinet6/raw_ip6.c                        inet6
+file netinet6/udp6_usrreq.c            inet6
+file netinet6/ah_core.c                        ipsec
+file netinet6/esp_core.c               ipsec & ipsec_esp
+file netinet6/ipsec.c                  ipsec
+file netinet6/ah_output.c              ipsec
+file netinet6/ah_input.c               ipsec
+file netinet6/esp_output.c             ipsec & ipsec_esp
+file netinet6/esp_input.c              ipsec & ipsec_esp
+file crypto/des/des_cbc.c              ipsec & ipsec_esp
+file crypto/des/des_ecb.c              ipsec & ipsec_esp
+file crypto/des/des_setkey.c           ipsec & ipsec_esp
+file crypto/des/des_3cbc.c             ipsec & ipsec_esp
+file crypto/blowfish/bf_cbc.c          ipsec & ipsec_esp
+file crypto/blowfish/bf_cbc_m.c                ipsec & ipsec_esp
+file crypto/blowfish/bf_enc.c          ipsec & ipsec_esp
+file crypto/blowfish/bf_skey.c         ipsec & ipsec_esp
+file crypto/cast128/cast128.c          ipsec & ipsec_esp
+file crypto/cast128/cast128_cbc.c      ipsec & ipsec_esp
+file crypto/rc5/rc5.c                  ipsec & ipsec_esp
+file crypto/rc5/rc5_cbc.c              ipsec & ipsec_esp
+file netinet6/ipcomp_core.c            ipsec
+file netinet6/ipcomp_input.c           ipsec
+file netinet6/ipcomp_output.c          ipsec
 file kern/exec_elf32.c                 exec_elf32
 file kern/exec_elf64.c                 exec_elf64
 file kern/exec_elf_common.c            exec_elf32 | exec_elf64
@@ -678,7 +734,7 @@
 file net/route.c
 file net/rtsock.c
 file net/slcompress.c                  sl | ppp | strip
-file net/zlib.c                                ppp & ppp_deflate
+file net/zlib.c                                (ppp & ppp_deflate) | ipsec
 file netccitt/ccitt_proto.c            ccitt
 file netccitt/hd_debug.c               hdlc
 file netccitt/hd_input.c               hdlc
diff -r 93565cc4759d -r 04cd0b816ba9 sys/dev/ic/midway.c
--- a/sys/dev/ic/midway.c       Thu Jul 01 07:59:57 1999 +0000
+++ b/sys/dev/ic/midway.c       Thu Jul 01 08:12:45 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: midway.c,v 1.38 1999/02/12 00:57:42 thorpej Exp $      */
+/*     $NetBSD: midway.c,v 1.39 1999/07/01 08:12:46 itojun Exp $       */
 /*     (sync'd to midway.c 1.68)       */
 
 /*
@@ -46,7 +46,26 @@
  *   I would also like to thank Werner for promptly answering email and being
  *   generally helpful.
  */
-
+/*
+ *  1997/12/02, major update on 1999/04/06 kjc
+ *    new features added:
+ *     - BPF support (link type is DLT_ATM_RFC1483)
+ *       BPF understands only LLC/SNAP!! (because bpf can't
+ *       handle variable link header length.)
+ *       (bpfwrite should work if atm_pseudohdr and LLC/SNAP are prepended.)
+ *     - support vc shaping
+ *     - integrate IPv6 support.
+ *     - support pvc sub interface
+ *
+ *       initial work on per-pvc-interface for ipv6 was done
+ *       by Katsushi Kobayashi <ikob%cc.uec.ac.jp@localhost> of the WIDE Project.
+ *       some of the extensions for pvc subinterfaces are merged from
+ *       the CAIRN project written by Suresh Bhogavilli (suresh%isi.edu@localhost).
+ *
+ *    code cleanup:
+ *     - remove WMAYBE related code.  ENI WMAYBE DMA doen't work.
+ *     - remove updating if_lastchange for every packet.
+ */
 
 #undef EN_DEBUG
 #undef EN_DEBUG_RANGE          /* check ranges on en_read/en_write's? */
@@ -133,24 +152,34 @@
 #include <sys/mbuf.h>
 #include <sys/socket.h>
 #include <sys/socketvar.h>
+#include <sys/queue.h>
 
 #include <net/if.h>
 #include <net/if_atm.h>
 
 #include <vm/vm.h>
 
-#ifdef INET
+#if defined(INET) || defined(INET6)
+#include <netinet/in.h>
 #include <netinet/if_atm.h>
+#ifdef INET6
+#include <netinet6/in6_var.h>
+#endif
 #endif
 
 #ifdef NATM
+#if !(defined(INET) || defined(INET6))
 #include <netinet/in.h>
+#endif
 #include <netnatm/natm.h>
 #endif
 
 
 #if !defined(__FreeBSD__)
 #include <machine/bus.h>
+
+#define LIST_FOREACH(var, head, field)                                 \
+       for((var) = (head)->lh_first; (var); (var) = (var)->field.le_next)
 #endif
 
 #if defined(__NetBSD__) || defined(__OpenBSD__)
@@ -180,6 +209,18 @@
 
 #endif /* __FreeBSD__ */
 
+#include "bpfilter.h"
+#if NBPFILTER > 0
+#include <net/bpf.h>
+#ifdef __FreeBSD__
+#define BPFATTACH(ifp, dlt, hlen)      bpfattach((ifp), (dlt), (hlen))
+#define BPF_MTAP(ifp, m)               bpf_mtap((ifp), (m))
+#else
+#define BPFATTACH(ifp, dlt, hlen)      bpfattach(&(ifp)->if_bpf, (ifp), (dlt), (hlen))
+#define BPF_MTAP(ifp, m)               bpf_mtap((ifp)->if_bpf, (m))
+#endif
+#endif /* NBPFILTER > 0 */
+
 /*
  * params
  */
@@ -305,6 +346,17 @@
 STATIC INLINE  void en_write __P((struct en_softc *, u_int32_t,
                    u_int32_t)) __attribute__ ((unused));
 
+#ifdef ATM_PVCEXT
+static void rrp_add __P((struct en_softc *, struct ifnet *));
+static struct ifnet *en_pvcattach __P((struct ifnet *));
+static int en_txctl __P((struct en_softc *, int, int, int));
+static int en_pvctx __P((struct en_softc *, struct pvctxreq *));
+static int en_pvctxget __P((struct en_softc *, struct pvctxreq *));
+static int en_pcr2txspeed __P((int));
+static int en_txspeed2pcr __P((int));
+static struct ifnet *en_vci2ifp __P((struct en_softc *, int));
+#endif
+
 /*
  * macros/inline
  */
@@ -432,10 +484,8 @@
 {
 
 #ifdef EN_DEBUG_RANGE
-  if (r > MID_MAXOFF || (r % 4)) {
-    printf("en_read out of range, r=0x%x\n", r);
-    panic("en_read");
-  }
+  if (r > MID_MAXOFF || (r % 4))
+    panic("en_read out of range, r=0x%x", r);
 #endif
 
   return(bus_space_read_4(sc->en_memt, sc->en_base, r));
@@ -453,10 +503,8 @@
 
 {
 #ifdef EN_DEBUG_RANGE
-  if (r > MID_MAXOFF || (r % 4)) {
-    printf("en_write out of range, r=0x%x\n", r);
-    panic("en_write");
-  }
+  if (r > MID_MAXOFF || (r % 4))
+    panic("en_write out of range, r=0x%x", r);
 #endif
 
   bus_space_write_4(sc->en_memt, sc->en_base, r, v);
@@ -773,6 +821,9 @@
     sz -= (EN_TXSZ * 1024);
     sc->txslot[lcv].stop = ptr;
     sc->txslot[lcv].nref = 0;
+#ifdef ATM_PVCEXT
+    sc->txrrp = NULL;
+#endif
     bzero(&sc->txslot[lcv].indma, sizeof(sc->txslot[lcv].indma));
     bzero(&sc->txslot[lcv].q, sizeof(sc->txslot[lcv].q));
 #ifdef EN_DEBUG
@@ -831,6 +882,9 @@
   printf("%s: %d %dKB receive buffers, %d %dKB transmit buffers allocated\n",
        sc->sc_dev.dv_xname, sc->en_nrx, EN_RXSZ, EN_NTX, EN_TXSZ);
 
+  printf("%s: End Station Identifier (mac address) %s\n",
+        sc->sc_dev.dv_xname, ether_sprintf(sc->macaddr));
+
   /*
    * final commit
    */
@@ -838,6 +892,12 @@
   if_attach(ifp);
   atm_ifattach(ifp); 
 
+#if NBPFILTER > 0 
+  BPFATTACH(ifp, DLT_ATM_RFC1483, sizeof(struct atmllc));
+#endif
+#ifdef ATM_PVCEXT
+  rrp_add(sc, ifp);
+#endif
 }
 
 
@@ -1121,18 +1181,31 @@
                break;
 #endif
        case SIOCSIFADDR: 
+#ifdef INET6
+       case SIOCSIFADDR_IN6:
+#endif
                ifp->if_flags |= IFF_UP;
+               switch (ifa->ifa_addr->sa_family) {
 #ifdef INET
-               if (ifa->ifa_addr->sa_family == AF_INET) {
+               case AF_INET:
                        en_reset(sc);
                        en_init(sc);
                        ifa->ifa_rtrequest = atm_rtrequest; /* ??? */
                        break;
+#endif
+#ifdef INET6
+               case AF_INET6:
+                       en_reset(sc);
+                       en_init(sc);
+                       ifa->ifa_rtrequest = atm_rtrequest; /* ??? */



Home | Main Index | Thread Index | Old Index