Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Nov 2004 16:20:37 -0500
From:      John Baldwin <jhb@FreeBSD.org>
To:        Sten Spans <sten@blinkenlights.nl>
Cc:        freebsd-alpha@FreeBSD.org
Subject:   Re: alpha and em mtu
Message-ID:  <200411151620.37816.jhb@FreeBSD.org>
In-Reply-To: <Pine.SOC.4.61.0411152205370.1075@tea.blinkenlights.nl>
References:  <Pine.SOC.4.61.0411142153430.26307@tea.blinkenlights.nl> <200411151510.07790.jhb@FreeBSD.org> <Pine.SOC.4.61.0411152205370.1075@tea.blinkenlights.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 15 November 2004 04:07 pm, Sten Spans wrote:
> On Mon, 15 Nov 2004, John Baldwin wrote:
> > On Monday 15 November 2004 02:34 pm, Sten Spans wrote:
> >> On Mon, 15 Nov 2004, John Baldwin wrote:
> >>
> >> 548             /*
> >> 549              * Check that TCP offset makes sense,
> >> 550              * pull out TCP options and adjust length.             
> >> XXX 551              */
> >> 552             off = th->th_off << 2;
> >> 553             if (off < sizeof (struct tcphdr) || off > tlen) {
> >> 554                     tcpstat.tcps_rcvbadoff++;
> >> 555                     goto drop;
> >> 556             }
> >>
> >>
> >> The box that talks to the alpha has mtu 9014, this might
> >> help to expose the bug.
> >
> > It may be that the off0 argument is less than the size of an IP header
> > but is not a multiple of 4.  Can you try this to see if it prints
> > anything out before crashing:
> >
> > Index: netinet/tcp_input.c
> > ===================================================================
> > RCS file: /usr/cvs/src/sys/netinet/tcp_input.c,v
> > retrieving revision 1.255
> > diff -u -r1.255 tcp_input.c
> > --- netinet/tcp_input.c	7 Nov 2004 19:19:35 -0000	1.255
> > +++ netinet/tcp_input.c	15 Nov 2004 20:09:27 -0000
> > @@ -497,6 +497,8 @@
> > 			ip_stripoptions(m, (struct mbuf *)0);
> > 			off0 = sizeof(struct ip);
> > 		}
> > +		if (off0 & 0x3 != 0)
> > +			printf("%s: off0 %d is misaligned\n", __func__, off0);
> > 		if (m->m_len < sizeof (struct tcpiphdr)) {
> > 			if ((m = m_pullup(m, sizeof (struct tcpiphdr))) == 0) {
> > 				tcpstat.tcps_rcvshort++;
>
> changed to ((off0 & 0x3) != 0), didn't seem to print anything.

Ok, try this one then instead:

Index: netinet/tcp_input.c
===================================================================
RCS file: /usr/cvs/src/sys/netinet/tcp_input.c,v
retrieving revision 1.255
diff -u -r1.255 tcp_input.c
--- netinet/tcp_input.c	7 Nov 2004 19:19:35 -0000	1.255
+++ netinet/tcp_input.c	15 Nov 2004 21:19:50 -0000
@@ -504,6 +504,8 @@
 			}
 		}
 		ip = mtod(m, struct ip *);
+		if (((uintptr_t)ip & 0x3) != 0)
+			printf("%s: ip %p is misaligned\n", __func__, ip);
 		ipov = (struct ipovly *)ip;
 		th = (struct tcphdr *)((caddr_t)ip + off0);
 		tlen = ip->ip_len;


-- 
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411151620.37816.jhb>