NetBSD-Bugs archive

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

Re: kern/18035 IFF_SIMPLEX vs bridge(4)



The following reply was made to PR kern/18035; it has been noted by GNATS.

From: Christoph Badura <bad%bsd.de@localhost>
To: tech-net%netbsd.org@localhost
Cc: der Mouse <mouse%Rodents-Montreal.ORG@localhost>
Subject: Re: kern/18035 IFF_SIMPLEX vs bridge(4)
Date: Tue, 26 Aug 2008 23:16:05 +0200

 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