tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/48104: Incorrect forwarding of broadcast packets by bridge(4)



Hi all,
I finally got around to running the last test on my changes to bridge(4) and it 
all works well.

The only real problem I had to think about was that the point in the network 
stack for tapping off bridged packets was above the point in the network stack 
where packets are injected. This means that when multicasting packets up the 
network stack you have to do something to prevent a packet storm. My initial 
implementation used a link local mbuf flag, but bridging is inherently not link 
local, so I discarded that method. 

I settled on moving the point at which the bridge taps into the network stack 
down the stack so that it is now below the point at which packets are injected 
into the stack. In particular, I removed the bridge code from ether_input() and 
made the bridge update the struct ifnet if_input field when an interface is 
added to or removed from a bridge. The code for updating the if_input field is 
purposefully simple and conservative.

There are some interface drivers that call ether_input() directly instead of 
indirecting through struct ifnet if_input and that seems to be a requirement 
that was missed when porting the drivers from FreeBSD. I’ll PR those drivers 
once I finish this email and send this patch to kern/48104.

Overall this patch removes 107 of old code and adds 85 lines of new code. I 
know it’s a crude code metric, but I do like increased functionality with less 
code.

Cheers,
Lloyd

Attachment: bridge.diff
Description: Binary data





Home | Main Index | Thread Index | Old Index