Ethernet Bridge development
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Aijaz Baig <aijazbaig1@gmail.com>
Cc: bridge@linux-foundation.org
Subject: Re: [Bridge] About local delivery of bridged packets
Date: Tue, 12 Oct 2010 09:37:47 -0700	[thread overview]
Message-ID: <20101012093747.30a82cb2@nehalam> (raw)
In-Reply-To: <loom.20101012T145743-585@post.gmane.org>

On Tue, 12 Oct 2010 13:01:08 +0000 (UTC)
Aijaz Baig <aijazbaig1@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.

      reply	other threads:[~2010-10-12 16:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-11 13:29 [Bridge] About local delivery of bridged packets Aijaz Baig
2010-10-12 13:01 ` Aijaz Baig
2010-10-12 16:37   ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101012093747.30a82cb2@nehalam \
    --to=shemminger@linux-foundation.org \
    --cc=aijazbaig1@gmail.com \
    --cc=bridge@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox