Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Oct 2000 18:22:28 -0800 (PST)
From:      Luigi Rizzo <rizzo@aciri.org>
To:        aljtarik@inrs-telecom.uquebec.ca
Cc:        freebsd-net@FreeBSD.ORG
Subject:   Re: bdg_forward
Message-ID:  <200011010222.SAA08552@iguana.aciri.org>
In-Reply-To: <200010312114.QAA21225@cholla.INRS-Telecom.UQuebec.CA> from Tarik Alj at "Oct 31, 2000  4:14:55 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
> Hi all,

Hi,
there is a trick there to save one extra copy of the packet (the trick
is copied by the multicast forwarding code).

What you would would write is:

    for (ifp = first_if; ifp != NULL; ifp = ifp->next) {
	if (interface_needs_a_copy(ifp, pkt)) {
	    x = copy_of(pkt);
	    IF_ENQUEUE(ifp, pkt)
	}
    }
    mfree(pkt);

but it is more efficient to delay the copy (and the forwarding)
until you are really sure that you have to do it. The current code
is suboptimal but tries to achieve the above by delaying the
copy by one loop. It could be written slightly better (but at
the price of slightly more obfuscation) and delay the copy until
you find that the second matching interface.

	cheers
	luigi

----------------------------------+-----------------------------------------
 Luigi RIZZO, luigi@iet.unipi.it  . ACIRI/ICSI (on leave from Univ. di Pisa)
 http://www.iet.unipi.it/~luigi/  . 1947 Center St, Berkeley CA 94704
 Phone: (510) 666 2927
----------------------------------+-----------------------------------------
> 	I would like some clarification on something that happens in bdg_forward 
> when forwarding broadcast frames (such as ARP requests). In the beginning of the 
> code last is initialized to NULL, so that if a frame arrives on an iface whose 
> index is higher than 1 it will not be forwarded on the interface with index 1 
> because the if test after the for(;;) loop will fail. Is this meant to be this 
> way? And if so, could someone explain to me why?
> 	I am working with bridge.c v1.16, thanks in advance,
> 	
> -Tarik.
> 	
> 	
> 
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-net" in the body of the message
> 



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




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