Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic IPv6 support, from fujiwara%rcac.tdi.co.jp@localhost



details:   https://anonhg.NetBSD.org/src/rev/f0babd7fdcb2
branches:  trunk
changeset: 504388:f0babd7fdcb2
user:      itojun <itojun%NetBSD.org@localhost>
date:      Thu Mar 01 00:40:41 2001 +0000

description:
IPv6 support, from fujiwara%rcac.tdi.co.jp@localhost

diffstat:

 sys/dev/ic/hd64570.c    |  60 ++++++++++++++++++++++++++++++++++++++++++------
 sys/dev/ic/hd64570reg.h |   3 +-
 2 files changed, 54 insertions(+), 9 deletions(-)

diffs (137 lines):

diff -r 934c5be601ab -r f0babd7fdcb2 sys/dev/ic/hd64570.c
--- a/sys/dev/ic/hd64570.c      Wed Feb 28 20:44:41 2001 +0000
+++ b/sys/dev/ic/hd64570.c      Thu Mar 01 00:40:41 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hd64570.c,v 1.14 2001/01/17 00:30:50 thorpej Exp $     */
+/*     $NetBSD: hd64570.c,v 1.15 2001/03/01 00:40:41 itojun Exp $      */
 
 /*
  * Copyright (c) 1999 Christian E. Hopps
@@ -80,11 +80,14 @@
 #include <net/if_types.h>
 #include <net/netisr.h>
 
-#ifdef INET
+#if defined(INET) || defined(INET6)
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
 #include <netinet/in_var.h>
 #include <netinet/ip.h>
+#ifdef INET6
+#include <netinet6/in6_var.h>
+#endif
 #endif
 
 #ifdef ISO
@@ -839,6 +842,19 @@
                hdlc->h_proto = htons(HDLC_PROTOCOL_IP);
                break;  
 #endif
+#ifdef INET6
+       case AF_INET6:
+               /*
+                * Add cisco serial line header. If there is no
+                * space in the first mbuf, allocate another.
+                */     
+               M_PREPEND(m, sizeof(struct hdlc_header), M_DONTWAIT);
+               if (m == 0)
+                       return (ENOBUFS);
+               hdlc = mtod(m, struct hdlc_header *);
+               hdlc->h_proto = htons(HDLC_PROTOCOL_IPV6);
+               break;  
+#endif
 #ifdef ISO     
        case AF_ISO:
                /*
@@ -924,26 +940,39 @@
 
        switch (cmd) {
        case SIOCSIFADDR:
+               switch(ifa->ifa_addr->sa_family) {
 #ifdef INET
-               if (ifa->ifa_addr->sa_family == AF_INET) {
+               case AF_INET:
+#endif
+#ifdef INET6
+               case AF_INET6:
+#endif
+#if defined(INET) || defined(INET6)
                        ifp->if_flags |= IFF_UP;
                        sca_port_up(ifp->if_softc);
-               } else
+                       break;
 #endif
+               default:
                        error = EAFNOSUPPORT;
+                       break;
+               }
                break;
 
        case SIOCSIFDSTADDR:
 #ifdef INET
-               if (ifa->ifa_addr->sa_family != AF_INET)
-                       error = EAFNOSUPPORT;
-#else
+               if (ifa->ifa_addr->sa_family == AF_INET)
+                       break;
+#endif
+#ifdef INET6
+               if (ifa->ifa_addr->sa_family == AF_INET6)
+                       break;
+#endif
                error = EAFNOSUPPORT;
-#endif
                break;
 
        case SIOCADDMULTI:
        case SIOCDELMULTI:
+               /* XXX need multicast group management code */
                if (ifr == 0) {
                        error = EAFNOSUPPORT;           /* XXX */
                        break;
@@ -953,6 +982,10 @@
                case AF_INET:
                        break;
 #endif
+#ifdef INET6
+               case AF_INET6:
+                       break;
+#endif
                default:
                        error = EAFNOSUPPORT;
                        break;
@@ -1592,6 +1625,17 @@
                schednetisr(NETISR_IP);
                break;
 #endif /* INET */
+#ifdef INET6
+       case HDLC_PROTOCOL_IPV6:
+               SCA_DPRINTF(SCA_DEBUG_RX, ("Received IP packet\n"));
+               m->m_pkthdr.rcvif = &scp->sp_if;
+               m->m_pkthdr.len -= sizeof(struct hdlc_header);
+               m->m_data += sizeof(struct hdlc_header);
+               m->m_len -= sizeof(struct hdlc_header);
+               ifq = &ip6intrq;
+               schednetisr(NETISR_IPV6);
+               break;
+#endif /* INET6 */
 #ifdef ISO
        case HDLC_PROTOCOL_ISO:
                if (m->m_pkthdr.len < sizeof(struct hdlc_llc_header)) 
diff -r 934c5be601ab -r f0babd7fdcb2 sys/dev/ic/hd64570reg.h
--- a/sys/dev/ic/hd64570reg.h   Wed Feb 28 20:44:41 2001 +0000
+++ b/sys/dev/ic/hd64570reg.h   Thu Mar 01 00:40:41 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hd64570reg.h,v 1.5 2000/01/09 14:47:43 chopps Exp $    */
+/*     $NetBSD: hd64570reg.h,v 1.6 2001/03/01 00:40:41 itojun Exp $    */
 
 /*
  * Copyright (c) 1998 Vixie Enterprises
@@ -60,6 +60,7 @@
 #define CISCO_PKT_LEN  18      /* sizeof doesn't work right... */
 
 #define HDLC_PROTOCOL_IP       0x0800  /* IP */
+#define HDLC_PROTOCOL_IPV6     0x86dd  /* IPv6 */
 #define HDLC_PROTOCOL_ISO      0xfefe  /* LLC_ISO_LSAP dsap,ssap */
 
 struct hdlc_header {



Home | Main Index | Thread Index | Old Index