Avoid overlapping struct assignment for FDDI. Should fix netiso like in the

Ethernet case.
This commit is contained in:
is 2006-12-10 12:34:42 +00:00
parent 287d53b453
commit 74a405e314
2 changed files with 14 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_fddisubr.c,v 1.63 2006/09/07 02:40:33 dogcow Exp $ */
/* $NetBSD: if_fddisubr.c,v 1.64 2006/12/10 12:34:42 is Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -96,7 +96,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_fddisubr.c,v 1.63 2006/09/07 02:40:33 dogcow Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_fddisubr.c,v 1.64 2006/12/10 12:34:42 is Exp $");
#include "opt_inet.h"
#include "opt_atalk.h"
@ -580,10 +580,7 @@ fddi_input(struct ifnet *ifp, struct mbuf *m)
m->m_flags |= M_LINK0;
#endif
/* Strip off the FDDI header. */
m_adj(m, sizeof(struct fddi_header));
l = mtod(m, struct llc *);
l = (struct llc *)(fh+1);
switch (l->llc_dsap) {
#if defined(INET) || defined(INET6) || defined(NS) || defined(DECNET) || defined(IPX) || defined(NETATALK)
case LLC_SNAP_LSAP:
@ -591,6 +588,10 @@ fddi_input(struct ifnet *ifp, struct mbuf *m)
u_int16_t etype;
if (l->llc_control != LLC_UI || l->llc_ssap != LLC_SNAP_LSAP)
goto dropanyway;
/* Strip off the FDDI header. */
m_adj(m, sizeof(struct fddi_header));
#ifdef NETATALK
if (Bcmp(&(l->llc_snap_org_code)[0], at_org_code,
sizeof(at_org_code)) == 0 &&
@ -684,14 +685,7 @@ fddi_input(struct ifnet *ifp, struct mbuf *m)
/* LLC_UI_P forbidden in class 1 service */
if ((l->llc_dsap == LLC_ISO_LSAP) &&
(l->llc_ssap == LLC_ISO_LSAP)) {
/* LSAP for ISO */
m->m_data += 3; /* XXX */
m->m_len -= 3; /* XXX */
m->m_pkthdr.len -= 3; /* XXX */
M_PREPEND(m, sizeof *fh, M_DONTWAIT);
if (m == 0)
return;
*mtod(m, struct fddi_header *) = *fh;
schednetisr(NETISR_ISO);
inq = &clnlintrq;
break;
@ -700,7 +694,8 @@ fddi_input(struct ifnet *ifp, struct mbuf *m)
case LLC_XID:
case LLC_XID_P:
if(m->m_len < 6)
if(m->m_len <
LLC_XID_BASIC_MINLEN + sizeof(struct fddi_header))
goto dropanyway;
l->llc_window = 0;
l->llc_fid = 9;
@ -727,6 +722,7 @@ fddi_input(struct ifnet *ifp, struct mbuf *m)
eh->ether_dhost[i] = fh->fddi_shost[i];
}
eh->ether_type = 0;
m_adj(m, sizeof(struct fddi_header));
ifp->if_output(ifp, m, &sa, NULL);
return;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: clnp_input.c,v 1.33 2006/12/05 16:36:14 is Exp $ */
/* $NetBSD: clnp_input.c,v 1.34 2006/12/10 12:34:42 is Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -59,7 +59,7 @@ SOFTWARE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: clnp_input.c,v 1.33 2006/12/05 16:36:14 is Exp $");
__KERNEL_RCSID(0, "$NetBSD: clnp_input.c,v 1.34 2006/12/10 12:34:42 is Exp $");
#include "opt_iso.h"
@ -204,9 +204,7 @@ next:
case IFT_FDDI:
bcopy((caddr_t) (mtod(m, struct fddi_header *)->fddi_dhost),
(caddr_t) sh.snh_dhost, 2 * sizeof(sh.snh_dhost));
m->m_data += sizeof(struct fddi_header);
m->m_len -= sizeof(struct fddi_header);
m->m_pkthdr.len -= sizeof(struct fddi_header);
m_adj(m, sizeof(struct fddi_header) + LLC_UFRAMELEN);
break;
case IFT_PTPSERIAL:
case IFT_GIF: