kern/62989: ether_input computes incorrect m_pkthdr.len when mbufs are chained

Ruslan Ermilov ru at FreeBSD.org
Wed Feb 18 03:50:21 PST 2004


The following reply was made to PR kern/62989; it has been noted by GNATS.

From: Ruslan Ermilov <ru at FreeBSD.org>
To: Roselyn Lee <rosel at verniernetworks.com>
Cc: bug-followup at FreeBSD.org
Subject: Re: kern/62989: ether_input computes incorrect m_pkthdr.len when mbufs are chained
Date: Wed, 18 Feb 2004 13:48:59 +0200

 On Tue, Feb 17, 2004 at 06:39:09PM -0800, Roselyn Lee wrote:
 > m_pkthdr.len that is computed by ether_input() incorrectly assumes
 > m_len is the length of the entire packet.  For example, the sis0
 > driver could return a list of mbufs to hold an incoming packet when
 > the system is out of clusters.
 > 
 Can you please try this patch instead and let me know if it
 works for you?
 
 %%%
 Index: if_ethersubr.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/net/if_ethersubr.c,v
 retrieving revision 1.70.2.34
 diff -u -p -r1.70.2.34 if_ethersubr.c
 --- if_ethersubr.c	16 Jan 2004 20:01:16 -0000	1.70.2.34
 +++ if_ethersubr.c	18 Feb 2004 11:39:37 -0000
 @@ -564,9 +564,7 @@ ether_input(struct ifnet *ifp, struct et
  		}
  		m->m_pkthdr.rcvif = ifp;
  		eh = mtod(m, struct ether_header *);
 -		m->m_data += sizeof(struct ether_header);
 -		m->m_len -= sizeof(struct ether_header);
 -		m->m_pkthdr.len = m->m_len;
 +		m_adj(m, sizeof(*eh));
  	}
  
  	/* Check for a BPF tap */
 %%%
 
 
 Cheers,
 -- 
 Ruslan Ermilov
 FreeBSD committer
 ru at FreeBSD.org


More information about the freebsd-bugs mailing list