[Bridge] Monitor the status of two ethernet interface

Cameron Schaus cam at schaus.ca
Thu Dec 21 10:17:16 PST 2006


Jie Chen wrote:
> Hi Stephen,
>
> I've been reading the source code for a few days. I can locate these 
> two files:
> /usr/include/linux/sockios.h
> /usr/include/sys/ioctl.h
> and I want to look at the codes for the function ioctl(), since there 
> are so many files includes ioctl() under /usr/ folder. Do you have any 
> idea which specific one we are using? For example, does the one in 
> following file look the correct one?
> /usr/src/linux-2.6.15_gz/net/socket.c
The bridge ioctls are in net/bridge/br_ioctl.c, but some of the bridge 
functionality is done using the sysfs interface, whose code in is 
br_sys_{br,if}.c.

> Thanks for the nice architecture drawing. What is the relationship 
> between TCP/IP architecture and the architecture you showed me? The 
> bridge driver should be considered as physical layer and IP layer is 
> above that?
You will want to check out the netif_receive_skb function in 
net/core/dev.c and note the bridge hooks used to pass packets to the 
bride code.  This is done prior to IP processing.

> For STP, if there's no Daemon running behind, who's maintaining the 
> STP table and who decide which interface to go with?
This is done by the kernel bridge code, using timers and incoming 
packets to trigger STP state changes.  The code of interest is in 
/usr/src/linux/net/bridge/br_stp.*, with some of the timer creation/init 
done when bridge entities are created.  Search for br_stp_timer_init and 
br_stp_port_timer_init.

All of the bridge code is in net/bridge/ and I would recommend the 
"Understanding Linux Network Internals" book published by O'Reilly 
publishing.  This book has several chapters that explain in detail the 
linux bridge and STP implementation, as well as a chapter that explains 
STP in detail.

Cam




More information about the Bridge mailing list