tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/18035 IFF_SIMPLEX vs bridge(4)



On Fri, Aug 15, 2008 at 12:03:26AM -0400, der Mouse wrote:
> > I think "bridge doesn't learn MACs from broadcast packets" is a
> > reasonable approximation to a fix.

> It is.  I tried that and, while I still see the ARP request duplicated
> when tcpdumping vr0, I no longer see bridge1 learning MAC addresses on
> the wrong interface.
> 
> The patch I got this effect with is almost ludicrously simple:
> 
> @@ -1360,10 +1360,12 @@
>       /*
>        * If the interface is learning, and the source
>        * address is valid and not multicast, record
> -      * the address.
> +      * the address.  But don't do this if the destination
> +      * is broadcast; such packets are looped back too often.
>        */
>       if ((bif->bif_flags & IFBIF_LEARNING) != 0 &&
>           ETHER_IS_MULTICAST(eh->ether_shost) == 0 &&
> +         
> memcmp(etherbroadcastaddr,eh->ether_dhost,sizeof(etherbroadcastaddr)) &&
>           (eh->ether_shost[0] == 0 &&
>            eh->ether_shost[1] == 0 &&
>            eh->ether_shost[2] == 0 &&

You should be using ETHER_IS_MULTICAST(eh->ether_dhost) instead of memcmp().
That is the standard way.

I'm wondering whether the 's' in ether_shost in the original code is a typo.
's' and 'd' are next to each other on US keyboards.
AFAIK no protocols send ethernet packets with a multicast source address.
And if the ETHER_IS_MULTICAST() check is supposed to ensure that no multicast
addresses are put into the bridge routing table, the check should better be
moved inside bridge_rtupdate().

--chris


Home | Main Index | Thread Index | Old Index