[Bridge] physical interface on a bridge

Jørgen Hovland jorgen at hovland.cx
Tue Feb 21 12:50:00 PST 2006


Is there a way to either:
Find the real ifindex/ifname a mac-address is bound to
Find the real ifindex/ifname of an incoming packet

I am writing a dhcp server and need to know what real interface the dhcp re=
quest packet came from. An acceptable solution would be to get the interfac=
e by the mac-address, but that can be faked so I would rather get the inter=
face by knowing where the data actually came from. Data is IP, UDP broadcas=
I _could_ use raw sockets. The problem is when I do that, the program is us=
ing ~8% cpu on a 3.2ghz xeon64 just reading packets without doing anything =
due to the amount of traffic passing through the box (~200mbit and increasi=
ng) so that doesn't look like a good idea.

brctl showmacs returns a list of port numbers, but they dont make much sens=
e to me. They do not seem to be in the same order I added the interfaces? I=
s there a mapping here?

jorgen at ams41:/$ /tmp/brctl showmacs test0
port no mac addr                is local?       ageing timer
  2     00:04:e2:a8:3b:d7       no                 0.24
  1     00:08:a1:85:39:fd       no                17.31
133     00:0d:88:a3:61:4a       no                 9.90
  1     00:14:22:b0:cd:e0       yes                0.00
133     00:16:c7:f5:8f:e2       no                 0.48

Port 133 is the 901'th interface (0x385) I added to bridge test0. What does=
 133 point to?  The ifindex of this physical interface is 912 (0x390) (retr=
ieved with SIOCGIFINDEX).

I seem to be unable to add more than around 1024 interfaces to a single bri=
dge. Is there a way to increase this limit?

I am using linux kernel 2.6

Thanks a million,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux-foundation.org/pipermail/bridge/attachments/2006022=

More information about the Bridge mailing list