Don't assume the Token-Ring source route is in the m_pktdat. Use

m_data instead.  This isn't a problem with ARP packets but is correct
way to this.

Noticed by pmara@cactus.org (Shashi Mara).
This commit is contained in:
bad 1999-05-29 22:36:07 +00:00
parent dd3520c061
commit 0b3a9f9e00
2 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_tokensubr.c,v 1.5 1999/05/18 23:57:21 thorpej Exp $ */
/* $NetBSD: if_tokensubr.c,v 1.6 1999/05/29 22:36:07 bad Exp $ */
/*
* Copyright (c) 1997-1999
@ -214,7 +214,7 @@ token_output(ifp, m0, dst, rt0)
break;
case AF_ARP:
/*
* XXX source routing, assume m->pktdat contains the useful stuff
* XXX source routing, assume m->m_data contains the useful stuff
*/
ah = mtod(m, struct arphdr *);
ah->ar_hrd = htons(ARPHRD_IEEE802);
@ -245,7 +245,7 @@ token_output(ifp, m0, dst, rt0)
}
else {
bcopy((caddr_t)ar_tha(ah), (caddr_t)edst, sizeof(edst));
trh = (struct token_header *) m->m_pktdat;
trh = mtod(m, struct token_header *);
trh->token_ac = TOKEN_AC;
trh->token_fc = TOKEN_FC;
if (trh->token_shost[0] & TOKEN_RI_PRESENT) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_arp.c,v 1.59 1999/05/23 20:21:51 ad Exp $ */
/* $NetBSD: if_arp.c,v 1.60 1999/05/29 22:36:08 bad Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -639,15 +639,15 @@ in_arpinput(m)
}
#if NTOKEN > 0
/*
* XXX uses m_pktdat and assumes the complete answer including
* XXX uses m_data and assumes the complete answer including
* XXX token-ring headers is in the same buf
*/
if (ifp->if_type == IFT_ISO88025 &&
m->m_pktdat[8] & TOKEN_RI_PRESENT) {
m->m_data[8] & TOKEN_RI_PRESENT) {
struct token_rif *rif;
size_t riflen;
rif = TOKEN_RIF((struct token_header *) m->m_pktdat);
rif = TOKEN_RIF(mtod(m, struct token_header *));
riflen = (ntohs(rif->tr_rcf) & TOKEN_RCF_LEN_MASK) >> 8;
if (riflen > 2 && riflen < sizeof(struct token_rif) &&