Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Mar 2000 15:31:10 -0500 (EST)
From:      Robert Watson <robert@cyrus.watson.org>
To:        Luigi Rizzo <luigi@info.iet.unipi.it>
Cc:        jkh@freebsd.org, freebsd-ipfw@freebsd.org
Subject:   fix to bridging code--m_dup instead of m_copypacket
Message-ID:  <Pine.NEB.3.96L.1000307145031.16458D-100000@fledge.watson.org>

next in thread | raw e-mail | index | archive | help

Luigi,

I patched support for bridging into if_dc.c and discovered a
problem--broadcast packets were being correctly bridged, but were not
being delivered to the bridge itself (?).  It looks like some interface
output code modifies the packet in-place, and copies for per-interface
delivery were made using m_copypacket instead of m_dup.  Changing the code
to use m_dup instead appeared to work correctly.  I'm not sure why the
packet is getting modified in-place, as it goes out on the bridged segment
with the broadcast address.  Also, it introduces an extra copy for each
interface a packet is delivered to, which can be large if your MAC address
working set exceeds the address hash, etc.  However, it seems to make
things much more stable from the perspective of communicating with the
bridge box.

Here's the patch against -current, which I'd like to commit before the
release if it looks OK by you.  I'd also like to commit bridge support for
if_dc.c, which prompted me to discover this problem.  Assuming this fix is
good, I'll do that as a followup.

Index: bridge.c
===================================================================
RCS file: /home/ncvs/src/sys/net/bridge.c,v
retrieving revision 1.16
diff -u -r1.16 bridge.c
--- bridge.c	2000/02/08 14:53:55	1.16
+++ bridge.c	2000/03/07 20:16:33
@@ -788,10 +788,10 @@
 	    if (canfree && once ) { /* no need to copy */
 		m = *m0 ;
 		*m0 = NULL ; /* original is gone */
-	    } else /* on a P5-90, m_copypacket takes 540 ticks */
-		m = m_copypacket(*m0, M_DONTWAIT);
+	    } else
+		m = m_dup(*m0, M_DONTWAIT);
 	    if (m == NULL) {
-		printf("bdg_forward: sorry, m_copy failed!\n");
+		printf("bdg_forward: sorry, m_dup failed!\n");
 		return ENOBUFS ; /* the original is still there... */
 	    }
 	    /*


  Robert N M Watson 

robert@fledge.watson.org              http://www.watson.org/~robert/
PGP key fingerprint: AF B5 5F FF A6 4A 79 37  ED 5F 55 E9 58 04 6A B1
TIS Labs at Network Associates, Safeport Network Services



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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1000307145031.16458D-100000>