Zeroth version of IPv6 support for ARCnet. Correct MTU handling still needs
to be done.
This commit is contained in:
parent
1b38b2e234
commit
6a793d8a47
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_arcsubr.c,v 1.26 1999/08/29 20:38:36 is Exp $ */
|
||||
/* $NetBSD: if_arcsubr.c,v 1.27 1999/09/19 21:31:33 is Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Ignatios Souvatzis
|
||||
@ -67,6 +67,15 @@
|
||||
#include <netinet/if_inarp.h>
|
||||
#endif
|
||||
|
||||
#ifdef INET6
|
||||
#ifndef INET
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#include <netinet6/in6_var.h>
|
||||
#include <netinet6/nd6.h>
|
||||
#include <netinet6/in6_ifattach.h>
|
||||
#endif
|
||||
|
||||
#define ARCNET_ALLOW_BROKEN_ARP
|
||||
|
||||
#ifndef ARC_PHDSMTU
|
||||
@ -222,6 +231,19 @@ arc_output(ifp, m0, dst, rt0)
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#ifdef INET6
|
||||
case AF_INET6:
|
||||
#ifdef NEWIP6OUTPUT
|
||||
if (!nd6_storelladdr(ifp, rt, m, dst, (u_char *)&adst))
|
||||
return(0); /* it must be impossible, but... */
|
||||
#else
|
||||
if (!nd6_resolve(ifp, rt, m, dst, (u_char *)&adst))
|
||||
return(0); /* if not yet resolves */
|
||||
#endif /* NEWIP6OUTPUT */
|
||||
atype = htons(ARCTYPE_INET6);
|
||||
newencoding = 1;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case AF_UNSPEC:
|
||||
ah = (struct arc_header *)dst->sa_data;
|
||||
@ -331,7 +353,6 @@ arc_output(ifp, m0, dst, rt0)
|
||||
ah->arc_dhost = adst;
|
||||
ah->arc_shost = myself;
|
||||
}
|
||||
|
||||
s = splimp();
|
||||
/*
|
||||
* Queue message on interface, and start output if interface
|
||||
@ -378,10 +399,12 @@ arc_defrag(ifp, m)
|
||||
|
||||
ac = (struct arccom *)ifp;
|
||||
|
||||
m = m_pullup(m, ARC_HDRNEWLEN);
|
||||
if (m == NULL) {
|
||||
++ifp->if_ierrors;
|
||||
return NULL;
|
||||
if (m->m_len < ARC_HDRNEWLEN) {
|
||||
m = m_pullup(m, ARC_HDRNEWLEN);
|
||||
if (m == NULL) {
|
||||
++ifp->if_ierrors;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ah = mtod(m, struct arc_header *);
|
||||
@ -396,10 +419,12 @@ arc_defrag(ifp, m)
|
||||
if (ah->arc_flag == 0xff) {
|
||||
m_adj(m, 4);
|
||||
|
||||
m = m_pullup(m, ARC_HDRNEWLEN);
|
||||
if (m == NULL) {
|
||||
++ifp->if_ierrors;
|
||||
return NULL;
|
||||
if (m->m_len < ARC_HDRNEWLEN) {
|
||||
m = m_pullup(m, ARC_HDRNEWLEN);
|
||||
if (m == NULL) {
|
||||
++ifp->if_ierrors;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ah = mtod(m, struct arc_header *);
|
||||
@ -513,9 +538,9 @@ int
|
||||
arc_isphds(type)
|
||||
u_int8_t type;
|
||||
{
|
||||
return ((type != ARCTYPE_IP_OLD &&
|
||||
type != ARCTYPE_ARP_OLD) &&
|
||||
(type != ARCTYPE_DIAGNOSE));
|
||||
return (type != ARCTYPE_IP_OLD &&
|
||||
type != ARCTYPE_ARP_OLD &&
|
||||
type != ARCTYPE_DIAGNOSE);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -587,6 +612,13 @@ arc_input(ifp, m)
|
||||
mtod(m, struct arphdr *)->ar_pro = htons(ETHERTYPE_IP);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#ifdef INET6
|
||||
case ARCTYPE_INET6:
|
||||
m_adj(m, ARC_HDRNEWLEN);
|
||||
schednetisr(NETISR_IPV6);
|
||||
inq = &ip6intrq;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
m_freem(m);
|
||||
@ -670,4 +702,7 @@ arc_ifattach(ifp, lla)
|
||||
arc_storelladdr(ifp, lla);
|
||||
|
||||
ifp->if_broadcastaddr = &arcbroadcastaddr;
|
||||
#ifdef INET6
|
||||
in6_ifattach_getifid(ifp);
|
||||
#endif
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: in6.c,v 1.5 1999/07/30 10:35:36 itojun Exp $ */
|
||||
/* $NetBSD: in6.c,v 1.6 1999/09/19 21:31:34 is Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
@ -785,6 +785,7 @@ in6_control(so, cmd, data, ifp, p)
|
||||
* disable DAD.
|
||||
*/
|
||||
switch (ifp->if_type) {
|
||||
case IFT_ARCNET:
|
||||
case IFT_ETHER:
|
||||
case IFT_FDDI:
|
||||
#if 0
|
||||
@ -1765,6 +1766,14 @@ in6_if_up(ifp)
|
||||
if (bcmp(&sdl->sdl_data[off], &ea, sizeof(ea)) != 0)
|
||||
in6_ifattach(ifp, type, LLADDR(sdl), 0);
|
||||
break;
|
||||
case IFT_ARCNET:
|
||||
type = IN6_IFT_ARCNET;
|
||||
if (sdl == NULL)
|
||||
break;
|
||||
off = sdl->sdl_nlen;
|
||||
if (sdl->sdl_data[off] != 0) /* XXX ?: */
|
||||
in6_ifattach(ifp, type, LLADDR(sdl), 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: in6_ifattach.c,v 1.7 1999/09/13 12:15:55 itojun Exp $ */
|
||||
/* $NetBSD: in6_ifattach.c,v 1.8 1999/09/19 21:31:34 is Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
@ -72,6 +72,10 @@ laddr_to_eui64(dst, src, len)
|
||||
size_t len;
|
||||
{
|
||||
switch (len) {
|
||||
case 1:
|
||||
bzero(dst, 7);
|
||||
dst[7] = src[0];
|
||||
break;
|
||||
case 6:
|
||||
dst[0] = src[0];
|
||||
dst[1] = src[1];
|
||||
@ -127,6 +131,8 @@ in6_ifattach_getifid(ifp0)
|
||||
case IFT_ETHER:
|
||||
case IFT_FDDI:
|
||||
case IFT_ATM:
|
||||
case IFT_ARCNET:
|
||||
/* what others? */
|
||||
/* IEEE802/EUI64 cases - what others? */
|
||||
addr = LLADDR(sdl);
|
||||
addrlen = sdl->sdl_alen;
|
||||
@ -343,6 +349,14 @@ in6_ifattach(ifp, type, laddr, noloop)
|
||||
(caddr_t)&ia->ia_addr.sin6_addr.s6_addr8[8],
|
||||
IFID_LEN);
|
||||
break;
|
||||
case IN6_IFT_ARCNET:
|
||||
ia->ia_ifa.ifa_rtrequest = nd6_rtrequest;
|
||||
ia->ia_ifa.ifa_flags |= RTF_CLONING;
|
||||
rtflag = RTF_CLONING;
|
||||
if (laddr == NULL)
|
||||
break;
|
||||
onebyte_to_eui64(&ia->ia_addr.sin6_addr.s6_addr8[8], laddr);
|
||||
break;
|
||||
}
|
||||
|
||||
ia->ia_ifa.ifa_metric = ifp->if_metric;
|
||||
@ -527,6 +541,7 @@ in6_ifattach(ifp, type, laddr, noloop)
|
||||
|
||||
/* mark the address TENTATIVE, if needed. */
|
||||
switch (ifp->if_type) {
|
||||
case IFT_ARCNET:
|
||||
case IFT_ETHER:
|
||||
case IFT_FDDI:
|
||||
#if 0
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: in6_ifattach.h,v 1.3 1999/07/03 21:30:18 thorpej Exp $ */
|
||||
/* $NetBSD: in6_ifattach.h,v 1.4 1999/09/19 21:31:34 is Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
@ -46,5 +46,6 @@ void in6_ifdetach __P((struct ifnet *));
|
||||
#define IN6_IFT_P2P 2
|
||||
#define IN6_IFT_802 3
|
||||
#define IN6_IFT_P2P802 4
|
||||
#define IN6_IFT_ARCNET 5
|
||||
|
||||
#endif /* _NETINET6_IN6_IFATTACH_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nd6.c,v 1.8 1999/07/31 18:41:17 itojun Exp $ */
|
||||
/* $NetBSD: nd6.c,v 1.9 1999/09/19 21:31:35 is Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
@ -184,6 +184,9 @@ nd6_setmtu(ifp)
|
||||
u_long oldlinkmtu = ndi->linkmtu;
|
||||
|
||||
switch(ifp->if_type) {
|
||||
case IFT_ARCNET: /* XXX MTU handling needs more work */
|
||||
ndi->maxmtu = MIN(60480, ifp->if_mtu);
|
||||
break;
|
||||
case IFT_ETHER:
|
||||
ndi->maxmtu = MIN(ETHERMTU, ifp->if_mtu);
|
||||
break;
|
||||
@ -788,6 +791,9 @@ nd6_resolve(ifp, rt, m, dst, desten)
|
||||
desten);
|
||||
return(1);
|
||||
break;
|
||||
case IFT_ARCNET:
|
||||
*desten = 0;
|
||||
return(1);
|
||||
default:
|
||||
return(0);
|
||||
}
|
||||
@ -1484,9 +1490,10 @@ nd6_output(ifp, m0, dst, rt0)
|
||||
|
||||
/*
|
||||
* XXX: we currently do not make neighbor cache on any interface
|
||||
* other than Ethernet and FDDI.
|
||||
* other than ARCnet, Ethernet and FDDI.
|
||||
*/
|
||||
if (ifp->if_type != IFT_ETHER && ifp->if_type != IFT_FDDI)
|
||||
if (ifp->if_type != IFT_ARCNET &&
|
||||
ifp->if_type != IFT_ETHER && ifp->if_type != IFT_FDDI)
|
||||
goto sendpkt;
|
||||
|
||||
/*
|
||||
@ -1631,6 +1638,10 @@ nd6_storelladdr(ifp, rt, m, dst, desten)
|
||||
desten);
|
||||
return(1);
|
||||
break;
|
||||
case IFT_ARCNET:
|
||||
*desten = 0;
|
||||
return(1);
|
||||
break;
|
||||
default:
|
||||
return(0);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nd6_nbr.c,v 1.7 1999/07/31 18:41:17 itojun Exp $ */
|
||||
/* $NetBSD: nd6_nbr.c,v 1.8 1999/09/19 21:31:35 is Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
@ -441,12 +441,14 @@ nd6_ns_output(ifp, daddr6, taddr6, ln, dad)
|
||||
if (!dad && (mac = nd6_ifptomac(ifp))) {
|
||||
int optlen = sizeof(struct nd_opt_hdr) + ifp->if_addrlen;
|
||||
struct nd_opt_hdr *nd_opt = (struct nd_opt_hdr *)(nd_ns + 1);
|
||||
/* 8 byte alignments... */
|
||||
optlen = (optlen + 7) & ~7;
|
||||
|
||||
m->m_pkthdr.len += optlen;
|
||||
m->m_len += optlen;
|
||||
icmp6len += optlen;
|
||||
bzero((caddr_t)nd_opt, optlen);
|
||||
nd_opt->nd_opt_type = ND_OPT_SOURCE_LINKADDR;
|
||||
/* xxx 8 byte alignments? */
|
||||
nd_opt->nd_opt_len = optlen >> 3;
|
||||
bcopy(mac, (caddr_t)(nd_opt + 1), ifp->if_addrlen);
|
||||
}
|
||||
@ -790,11 +792,14 @@ nd6_na_output(ifp, daddr6, taddr6, flags, tlladdr)
|
||||
int optlen = sizeof(struct nd_opt_hdr) + ifp->if_addrlen;
|
||||
struct nd_opt_hdr *nd_opt = (struct nd_opt_hdr *)(nd_na + 1);
|
||||
|
||||
/* roundup to 8 bytes alignment! */
|
||||
optlen = (optlen + 7) & ~7;
|
||||
|
||||
m->m_pkthdr.len += optlen;
|
||||
m->m_len += optlen;
|
||||
icmp6len += optlen;
|
||||
bzero((caddr_t)nd_opt, optlen);
|
||||
nd_opt->nd_opt_type = ND_OPT_TARGET_LINKADDR;
|
||||
/* xxx 8 bytes alignment? */
|
||||
nd_opt->nd_opt_len = optlen >> 3;
|
||||
bcopy(mac, (caddr_t)(nd_opt + 1), ifp->if_addrlen);
|
||||
} else
|
||||
@ -818,6 +823,7 @@ nd6_ifptomac(ifp)
|
||||
struct ifnet *ifp;
|
||||
{
|
||||
switch (ifp->if_type) {
|
||||
case IFT_ARCNET:
|
||||
case IFT_ETHER:
|
||||
case IFT_FDDI:
|
||||
#ifdef __NetBSD__
|
||||
|
Loading…
Reference in New Issue
Block a user