Subject: if_tokensubr.c fix for netiso
To: None <tech-net@netbsd.org>
From: Ignatios Souvatzis <is@netbsd.org>
List: tech-net
Date: 12/05/2006 17:26:08
--xHFwDpU9dbj6ez1V
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Here's part three of the patches, for FDDI (netinet/token_subr.c).
Sorry, no clnp_input changes; that part is missing. I'll regenerate
it seperately. For now, please test IP over token ring.

I did test that it compiles, but not run-time - no token ring here.

Regards,
	-is

--xHFwDpU9dbj6ez1V
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=netiso_token_diff

Index: sys/net/if_tokensubr.c
===================================================================
RCS file: /cvsroot/src/sys/net/if_tokensubr.c,v
retrieving revision 1.39
diff -u -r1.39 if_tokensubr.c
--- sys/net/if_tokensubr.c	7 Sep 2006 02:40:33 -0000	1.39
+++ sys/net/if_tokensubr.c	5 Dec 2006 16:17:43 -0000
@@ -512,9 +512,9 @@
 		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 *)( ((u_int8_t *)trh) + lan_hdr_len);
+
 	switch (l->llc_dsap) {
 #if defined(INET) || defined(NS) || defined(DECNET)
 	case LLC_SNAP_LSAP:
@@ -527,7 +527,7 @@
 		    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 @@
 			/* 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");

--xHFwDpU9dbj6ez1V--