Jeff Terrell

Jeff Terrell
Graduate Student
Department of Computer Science
University of North Carolina at Chapel Hill

jsterrel AT cs.unc.edu
(919) 962-1791 (office)

No /usr/include/net/bpf.h header in Linux

Setup

I am on a Gentoo Linux machine running a 2.6.10 kernel. I believe I ran into this problem while trying to compile tcpslice. However, I gather from googling that many other Linux distributions and network-related tools (such as ethereal) are affected.

Symptoms

I forget the exact error message given by gcc since this happened a couple of days ago, but I do know that it failed on a #include <net/bpf.h> line because it couldn't find the header file.

Background

BPF stands for Berkeley Packet Filter, and I believe this is something that is supported on BSD systems. Linux does not support BPF by default. However, libpcap provides a compatible header.

Resolution

Install libpcap, using whatever means necessary. Then simply:

cp /usr/include/pcap-bpf.h /usr/include/net/bpf.h

articles/net-bpf.php: Last Modified: 12/03/07@18:01:18 | Size: 1397 bytes | View Source