Ethernet Bridge development
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: "Jørgen Hovland" <jorgen@hovland.cx>
Cc: bridge@lists.osdl.org
Subject: Re: [Bridge] physical interface on a bridge
Date: Thu, 23 Feb 2006 10:27:31 -0800	[thread overview]
Message-ID: <20060223102731.5756f778@localhost.localdomain> (raw)
In-Reply-To: <005601c63854$a2fdace0$0f01a8c0@tungemaskin>

On Thu, 23 Feb 2006 09:39:18 +0100
Jørgen Hovland <jorgen@hovland.cx> wrote:

> (sorry about the empty last email)
> 
> ----- Original Message ----- 
> From: "Stephen Hemminger" <shemminger@osdl.org>
> 
> > On Wed, 22 Feb 2006 09:42:49 +0100
> > Jørgen Hovland <jorgen@hovland.cx> wrote:
> >
> >> So there is no way to get the physical interface from a mac address?
> >
> > You can read the forwarding database (see brctl sources for how).
> > But the value can change as result of traffic.
> >
> 
> 
> I did actually look at the code before I emailed the list. Sorry if I am 
> missing something, but a fdb_entry maps a hardware address to a port number. 
> This arbitary port number points to the port_info structure which seems to 
> only hold information about what bridge it belongs to. And the bridge_info 
> structure doesn't contain any information either.
> The only place I can find something that might be useful is in 
> linux/netdevice.h and the "struct net_bridge_port  *br_port" under the 
> net_device structure. This is inside the kernel as it needs __KERNEL__ 
> defined in order to use it, or is this what I am looking for?
> 
> Thank you once again
> 
> Joergen 

The old way is to do ioctl() SIOCDEV_PRIVATE with BRCTL_GET_BRIDGES
and that gives a table of ifindices, you can use that to map port -> ifindex -> etherdevice

Newer way is to look in directory:
	/sys/class/net/brX/brif
It has symlinks to the devices that are being bridged.
	/sys/class/net/eth0/brport/port_id
contains the portid of eth0 in what ever bridge it is in.

  reply	other threads:[~2006-02-23 18:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-21 20:50 [Bridge] physical interface on a bridge Jørgen Hovland
2006-02-21 22:17 ` Stephen Hemminger
2006-02-22  8:42   ` Jørgen Hovland
2006-02-22 16:02     ` Stephen Hemminger
2006-02-23  8:30       ` Jørgen Hovland
2006-02-23  8:39       ` Jørgen Hovland
2006-02-23 18:27         ` Stephen Hemminger [this message]
2006-02-24 13:20           ` Jørgen Hovland

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=20060223102731.5756f778@localhost.localdomain \
    --to=shemminger@osdl.org \
    --cc=bridge@lists.osdl.org \
    --cc=jorgen@hovland.cx \
    /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