Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Dec 2001 19:30:01 -0800 (PST)
From:      Bill Fenner <fenner@research.att.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/31954: rwhod does not see itself via xl0
Message-ID:  <200112040330.fB43U1922166@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/31954; it has been noted by GNATS.

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 */
  		}

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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