[PATCH] BPF to support directions and more

Jung-uk Kim jkim at FreeBSD.org
Wed Feb 14 23:29:54 UTC 2007


I was playing with some BPF ideas for few days and I added two new 
features.  SEESENT flag is extended to see only outgoing packets, 
which is analogous to libpcap's PCAP_D_OUT direction.  Thus SEESENT 
is now called DIRECTION.  Second feature is feedback mode (sort of 
simulated hardware loopback), i.e., when packets are injected, you 
can feed them back as if they are coming from the wire.  You can 
debug link layer protocols easily with this without second machine, 
network controller, or loopback plug.  It's only tested with 
Ethernet, though.  All necessary patches (including libpcap 
modification) are here:

http://people.freebsd.org/~jkim/bpf_feedback.diff

Don't forget to turn off all hardware assisted features (e.g., RX/TX 
checksum offloading) to test feedback mode.  Otherwise, packets will 
be dropped.

Jung-uk Kim

Note: Actually I started this for QEMU networking, so that's another 
example.  See:

http://docs.freebsd.org/cgi/mid.cgi?200702092002.31220.jkim


More information about the freebsd-net mailing list