[Bridge] About local delivery of bridged packets

Stephen Hemminger shemminger at linux-foundation.org
Tue Oct 12 09:37:47 PDT 2010

On Tue, 12 Oct 2010 13:01:08 +0000 (UTC)
Aijaz Baig <aijazbaig1 at gmail.com> wrote:

> Aijaz Baig <aijazbaig1 <at> gmail.com> writes:
> > 
> > Hello,
> > 
> > I am trying to understand how does the bridging code determine if the packet 
> is 
> > to be delivered locally or is it to be forwarded. Before being delivered 
> > locally, I mean the packet is to be delivered either to br0 or to a non 
> enslaved 
> > interface. If I am wrong here, please do correct me..................
> Hello,
> Heres answering my own question partially. Since the bridge which is after all a 
> virtual interface takes one of the L2 addresses of its interfaces (is it the 
> first real interface which is enslaved?), any packet which is destined with this 
> L2 dest address in its eth header, will be considered locally destined.
> This simple fact solves my issue.
> Regards,
> Aijaz

You have it almost right!
The bridge keeps a forwarding database that contains:

      Ethernet-address   Port-device  flags
    11:22:33:44:55        eth0          local
    01:20:30:40:50        eth0

When eth0 is added to bridge, the address for eth0 is added
to forwarding table with local flag set.  The local flag indicates
during receive that the packet should be received locally.

If multiple devices are in bridge, then the bridge will locally
receive all those addresses.

The logic for this is in br_input.c:br_handle_frame_finish function.

More information about the Bridge mailing list