From marcolz@serv4.ilse.nl  Tue Nov 13 09:20:22 2001
Return-Path: <marcolz@serv4.ilse.nl>
Received: from serv1.ilse.nl (serv1.ilse.nl [195.18.92.131])
	by hub.freebsd.org (Postfix) with ESMTP id 2A59C37B405
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 13 Nov 2001 09:20:21 -0800 (PST)
Received: from serv4.ilse.nl (serv4.ilse.nl [10.1.8.14])
	by serv1.ilse.nl (8.11.6/8.10.2) with ESMTP id fADHKDU18856
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 13 Nov 2001 18:20:13 +0100 (MET)
Received: (from marcolz@localhost)
	by serv4.ilse.nl (8.11.6/8.11.1) id fADHKBr01666;
	Tue, 13 Nov 2001 18:20:11 +0100 (CET)
	(envelope-from marcolz)
Message-Id: <200111131720.fADHKBr01666@serv4.ilse.nl>
Date: Tue, 13 Nov 2001 18:20:11 +0100 (CET)
From: Marc Olzheim <marcolz@ilse.nl>
Reply-To: Marc Olzheim <marcolz@ilse.nl>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: rwhod does not see itself via xl0
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         31954
>Category:       kern
>Synopsis:       rwhod does not see itself via xl0
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    fenner
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 13 09:30:01 PST 2001
>Closed-Date:    Fri Jan 11 08:05:01 PST 2002
>Last-Modified:  Fri Jan 11 08:05:29 PST 2002
>Originator:     Marc Olzheim
>Release:        FreeBSD 4.4-STABLE i386
>Organization:
ilse technology
>Environment:
System: FreeBSD serv4.ilse.nl 4.4-STABLE FreeBSD 4.4-STABLE #0: Tue Nov 13 16:41:35 CET 2001 root@serv4.ilse.nl:/usr/src/sys/compile/serv4 i386

pciconf -l:
xl0@pci0:11:0:  class=0x020000 card=0x905510b7 chip=0x905510b7 rev=0x30
hdr=0x00

dmesg:
xl0: Ethernet address: 00:50:da:72:8d:ac
miibus0: <MII bus> on xl0
xlphy0: <3Com internal media interface> on miibus0
xlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto

and

pciconf -l:
fxp0@pci0:4:0:  class=0x020000 card=0x000c8086 chip=0x12298086 rev=0x08
hdr=0x00

dmesg:
fxp0: <Intel Pro 10/100B/100+ Ethernet> port 0xd400-0xd43f mem 0xfe700000-0xfe7fffff,0xfe8fe000-0xfe8fefff irq 2 at device 4.0 on pci0
fxp0: Ethernet address 00:e0:81:03:c4:bf
inphy0: <i82555 10/100 media interface> on miibus0
inphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto

>Description:
	On systems with a 3com using the current stable-sourcetree,
	rwhod does not receive it's own broadcast packets, while on
	systems with a Intel Etherexpress pro 100, it works ok.
	Just replacing the 3com does the trick...

>How-To-Repeat:
	Just start rwhod.
>Fix:
>Release-Note:
>Audit-Trail:

From: Bill Fenner <fenner@research.att.com>
To: marcolz@ilse.nl
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: kern/31954: rwhod does not see itself via xl0
Date: Wed, 14 Nov 2001 00:53:21 -0800

 What if you turn off hardware checksums?
 
   Bill

From: Marc Olzheim <marcolz@ilse.nl>
To: Bill Fenner <fenner@research.att.com>
Cc: marcolz@ilse.nl, freebsd-gnats-submit@freebsd.org
Subject: Re: kern/31954: rwhod does not see itself via xl0
Date: Fri, 16 Nov 2001 02:30:30 +0100

 > 
 > What if you turn off hardware checksums?
 
 How ?
 
 I did try setting net.inet.udp.checksum to 0, but that did not have any
 effect.
 
 Marc

From: Bill Fenner <fenner@research.att.com>
To: freebsd-gnats-submit@freebsd.org, marcolz@ilse.nl
Cc: jlemon@freebsd.org
Subject: Re: kern/31954: rwhod does not see itself via xl0
Date: Mon, 3 Dec 2001 19:23:25 -0800 (PST)

 It turns out that when a broadcast packet is looped back, the checksums
 are checked on the way in even if they were not calculated on the
 way out.  This patch works for me; would you mind trying it?
 
 Thanks,
   Bill
 
 cvs diff: Diffing .
 Index: if_ethersubr.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/net/if_ethersubr.c,v
 retrieving revision 1.70.2.19
 diff -u -r1.70.2.19 if_ethersubr.c
 --- if_ethersubr.c	2001/11/04 22:32:16	1.70.2.19
 +++ if_ethersubr.c	2001/12/04 03:15:34
 @@ -331,12 +331,25 @@
  	 * reasons and compatibility with the original behavior.
  	 */
  	if ((ifp->if_flags & IFF_SIMPLEX) && (loop_copy != -1)) {
 +		int csum_flags = 0;
 +
 +		if (m->m_pkthdr.csum_flags & CSUM_IP)
 +			csum_flags |= (CSUM_IP_CHECKED|CSUM_IP_VALID);
 +		if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA)
 +			csum_flags |= (CSUM_DATA_VALID|CSUM_PSEUDO_HDR);
  		if ((m->m_flags & M_BCAST) || (loop_copy > 0)) {
  			struct mbuf *n = m_copy(m, 0, (int)M_COPYALL);
  
 +			n->m_pkthdr.csum_flags |= csum_flags;
 +			if (csum_flags & CSUM_DATA_VALID)
 +				n->m_pkthdr.csum_data = 0xffff;
 +
  			(void) if_simloop(ifp, n, dst->sa_family, hlen);
  		} else if (bcmp(eh->ether_dhost,
  		    eh->ether_shost, ETHER_ADDR_LEN) == 0) {
 +			m->m_pkthdr.csum_flags |= csum_flags;
 +			if (csum_flags & CSUM_DATA_VALID)
 +				m->m_pkthdr.csum_data = 0xffff;
  			(void) if_simloop(ifp, m, dst->sa_family, hlen);
  			return (0);	/* XXX */
  		}

From: Glenn Johnson <glennpj@charter.net>
To: freebsd-gnats-submit@FreeBSD.org, marcolz@ilse.nl
Cc:  
Subject: Re: kern/31954: rwhod does not see itself via xl0
Date: Mon, 10 Dec 2001 23:28:42 -0600

 I tested the patch and it works fine.
 

From: Glenn Johnson <glennpj@charter.net>
To: freebsd-gnats-submit@FreeBSD.org, marcolz@ilse.nl
Cc:  
Subject: Re: kern/31954: rwhod does not see itself via xl0
Date: Mon, 10 Dec 2001 23:32:42 -0600

 I tested the patch and it works fine.
 
Responsible-Changed-From-To: freebsd-bugs->fenner 
Responsible-Changed-By: ru 
Responsible-Changed-When: Wed Dec 19 01:11:38 PST 2001 
Responsible-Changed-Why:  
Bill asked for a feedback, and originator says patch worked OK. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=31954 
State-Changed-From-To: open->closed 
State-Changed-By: jesper 
State-Changed-When: Fri Jan 11 08:05:01 PST 2002 
State-Changed-Why:  
Patch committed to -current, will MFC before 4.5 if re@ approves 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=31954 
>Unformatted:
