From nobody@FreeBSD.org  Thu Feb 28 22:55:48 2002
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id A231437B417
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 28 Feb 2002 22:55:47 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.6/8.11.6) id g216tlk50800;
	Thu, 28 Feb 2002 22:55:47 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200203010655.g216tlk50800@freefall.freebsd.org>
Date: Thu, 28 Feb 2002 22:55:47 -0800 (PST)
From: "George V. Neville-Neil" <gnn@neville-neil.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Problem transmitting runts in if_sis driver (with patch for fix)
X-Send-Pr-Version: www-1.0

>Number:         35442
>Category:       kern
>Synopsis:       [sis] [patch] Problem transmitting runts in if_sis driver
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    yongari
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 28 23:00:01 PST 2002
>Closed-Date:    Fri Oct 08 23:39:07 UTC 2010
>Last-Modified:  Fri Oct 08 23:39:07 UTC 2010
>Originator:     George V. Neville-Neil
>Release:        -CURRENT (20 Feb 2002 from CVS)
>Organization:
Neville-Neil Consulting
>Environment:
Can't, embedded machine.
Soekris 4501 networked embedded board.     
>Description:
Packets that are less than the 60 byte minimum for ethernet
are transmitting with trailing 1 bits (this shows up at 0xff
in ethereal/tcpdump) instead of trailing 0 bits.  This is the
way the chip (National Semiconductor DP83815) interprets auto-padding.

>How-To-Repeat:
ping -s 1 -c 1 224.0.0.1

on the machine with the sis interface.

Check packets with ethereal/tcpdump.

>Fix:
Here is a context diff for a fix:


Index: if_sis.c
===================================================================
RCS file: /music/FreeBSD-CVS/src/sys/pci/if_sis.c,v
retrieving revision 1.48
diff -c -r1.48 if_sis.c
*** if_sis.c	6 Feb 2002 22:06:47 -0000	1.48
--- if_sis.c	1 Mar 2002 06:51:46 -0000
***************
*** 1665,1671 ****
  	struct ifnet		*ifp;
  {
  	struct sis_softc	*sc;
! 	struct mbuf		*m_head = NULL;
  	u_int32_t		idx;
  
  	sc = ifp->if_softc;
--- 1665,1671 ----
  	struct ifnet		*ifp;
  {
  	struct sis_softc	*sc;
! 	struct mbuf		*m_head = NULL, *m_zero = NULL;
  	u_int32_t		idx;
  
  	sc = ifp->if_softc;
***************
*** 1687,1692 ****
--- 1687,1701 ----
  		IF_DEQUEUE(&ifp->if_snd, m_head);
  		if (m_head == NULL)
  			break;
+ 
+ 		if (m_head->m_pkthdr.len < ETHER_MIN_LEN)	{
+ 		    m_zero = m_get_clrd(M_DONTWAIT, MT_DATA);
+ 		    if (m_zero == NULL)
+ 			break;
+ 		    m_zero->m_len = ETHER_MIN_LEN - m_head->m_pkthdr.len;
+ 		    m_cat(m_head, m_zero);
+ 		    m_head->m_pkthdr.len = ETHER_MIN_LEN;
+ 		}
  
  		if (sis_encap(sc, m_head, &idx)) {
  			IF_PREPEND(&ifp->if_snd, m_head);


>Release-Note:
>Audit-Trail:

From: "Crist J. Clark" <cjc@FreeBSD.ORG>
To: "George V. Neville-Neil" <gnn@neville-neil.com>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: kern/35442: Problem transmitting runts in if_sis driver (with patch for fix)
Date: Thu, 28 Feb 2002 23:46:15 -0800

 On Thu, Feb 28, 2002 at 10:55:47PM -0800, George V. Neville-Neil wrote:
 [snip]
 
 > Packets that are less than the 60 byte minimum for ethernet
 > are transmitting with trailing 1 bits (this shows up at 0xff
 > in ethereal/tcpdump) instead of trailing 0 bits.  This is the
 > way the chip (National Semiconductor DP83815) interprets
 > auto-padding.
 
 Uh, so? Why do you feel that these need to be zeroed?
 
 I am not aware of any standard demanding this. I've seen about every
 type of behavior you can imagine in the extra space, zeros, ones,
 regular patterns (0x0a0a...), pieces of the last packet (the memory
 was not cleared), and junk I never figured out.
 -- 
 Crist J. Clark                     |     cjclark@alum.mit.edu
                                    |     cjclark@jhu.edu
 http://people.freebsd.org/~cjc/    |     cjc@freebsd.org

From: Hiten Pandya <hiten@unixdaemons.com>
To: gnn@neville-neil.com
Cc: bug-followup@FreeBSD.org
Subject: Re: kern/35442 (Problem transmitting runts in if_sis driver)
Date: Wed, 08 Jan 2003 17:01:20 +0000

 There was recently a post to -doc (by mistake) about Ethernet 
 drivers not using null padding -- it made me wonder if this PR 
 had something to do with it:
 
 	http://www.kb.cert.org/vuls/id/412115?
 
 If so, can we implement this solution in a general manner?
 
 Cheers.
 
 -- 
 Hiten Pandya
 http://www.unixdaemons.com/~hiten
 hiten@uk.FreeBSD.org, hiten@unixdaemons.com
 
Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: vwe 
Responsible-Changed-When: Sat Mar 8 00:21:57 UTC 2008 
Responsible-Changed-Why:  

Over to maintainer(s). Please have a look at it. Thx! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=35442 
Responsible-Changed-From-To: freebsd-net->yongari 
Responsible-Changed-By: andre 
Responsible-Changed-When: Mon Aug 23 18:23:54 UTC 2010 
Responsible-Changed-Why:  
Over to expert. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=35442 
State-Changed-From-To: open->patched 
State-Changed-By: yongari 
State-Changed-When: Thu Sep 2 18:26:22 UTC 2010 
State-Changed-Why:  
Patch committed to HEAD(r212157). You have to set the following 
tunable to activate manual padding. 

dev.sis.%d.manual_pad="1" 

http://www.freebsd.org/cgi/query-pr.cgi?pr=35442 
State-Changed-From-To: patched->closed 
State-Changed-By: yongari 
State-Changed-When: Fri Oct 8 23:38:32 UTC 2010 
State-Changed-Why:  
MFC to stable/8 and stable/7 done. 
Thanks for reporting! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=35442 
>Unformatted:
