Avoid overlapping struct assignment, like in the Ethernet and FDDI cases.

This commit is contained in:
is 2006-12-10 14:39:03 +00:00
parent 635ee8a88f
commit d227658f6b
1 changed files with 6 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_tokensubr.c,v 1.39 2006/09/07 02:40:33 dogcow Exp $ */
/* $NetBSD: if_tokensubr.c,v 1.40 2006/12/10 14:39:03 is Exp $ */
/*
* Copyright (c) 1982, 1989, 1993
@ -99,7 +99,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_tokensubr.c,v 1.39 2006/09/07 02:40:33 dogcow Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_tokensubr.c,v 1.40 2006/12/10 14:39:03 is Exp $");
#include "opt_inet.h"
#include "opt_atalk.h"
@ -512,9 +512,9 @@ token_input(struct ifnet *ifp, struct mbuf *m)
trrif = TOKEN_RIF(trh);
lan_hdr_len += (ntohs(trrif->tr_rcf) & TOKEN_RCF_LEN_MASK) >> 8;
}
m_adj(m, lan_hdr_len);
l = mtod(m, struct llc *);
l = (struct llc *)(mtod(m, u_int8_t *) + lan_hdr_len);
switch (l->llc_dsap) {
#if defined(INET) || defined(NS) || defined(DECNET)
case LLC_SNAP_LSAP:
@ -527,7 +527,7 @@ token_input(struct ifnet *ifp, struct mbuf *m)
l->llc_snap.org_code[2] != 0)
goto dropanyway;
etype = ntohs(l->llc_snap.ether_type);
m_adj(m, LLC_SNAPFRAMELEN);
m_adj(m, lan_hdr_len + LLC_SNAPFRAMELEN);
#if NCARP > 0
if (ifp->if_carp && ifp->if_type != IFT_CARP &&
(carp_input(m, (u_int8_t *)&trh->token_shost,
@ -570,14 +570,7 @@ token_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 *trh, M_DONTWAIT);
if (m == 0)
return;
*mtod(m, struct token_header *) = *trh;
#if defined(__FreeBSD__)
IFDEBUG(D_ETHER)
printf("clnp packet");