Bug 29613

Summary: bridged packets diverted into userland with ipfw are not delivered to userland
Product: Base System Reporter: Tommy Johnson <tjohnson>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.4-PRERELEASE   
Hardware: Any   
OS: Any   

Description Tommy Johnson 2001-08-10 21:30:10 UTC
My goal is to build a satellite link simulator, and collect all the dropped packets.

setup an ethernet bridge, then divert packets into a divert socket.  While the packets properly leave the ipfw rules, they are never delivered to the divert socket itself.

How-To-Repeat: 
updev=xl0
backdev=xl1
printsocket=6975
upbw=10Mbits/sec
uplat=50
upplr=0.2
backbw=10Mbits/sec
backlat=50
backplr=0

sysctl -w net.link.ether.bridge_cfg="$updev:1,$backdev:1,"
sysctl -w net.link.ether.bridge=1
sysctl -w net.link.ether.bridge_ipfw=1

ipfw -q flush
ipfw -q pipe flush
ipfw pipe 10 config bw $upbw delay $uplat
ipfw pipe 11 config bw $backbw delay $backlat
ipfw add 90 prob $upplr   divert $printsocket ip from any to any via $updev   in
ipfw add 91 prob $backplr divert $printsocket ip from any to any via $backdev in
ipfw add 100 pipe 10 ip from any to any via $updev in
ipfw add 101 pipe 11 ip from any to any via $backdev in

Then run something which reads packets from a divert socket.  I used http://www.bobdbob.com/~protius/software/prettyprint.c.

Then run a ping or something through the ethernet bridge.  Note that while the packets are properly matched and removed from ipfw by rules 90 and 91, they are never delivered to prettyprint.
Comment 1 Luigi Rizzo freebsd_committer freebsd_triage 2002-07-13 22:44:47 UTC
State Changed
From-To: open->closed

divert is not supposed to work with bridged packets.