Jeff Terrell

Jeff Terrell
Ph.D. Candidate
Department of Computer Science
University of North Carolina at Chapel Hill

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

View Source of articles/net-bpf.php

In the interest of open source, and in the interest of keeping Mr. Webmaster honest, here is the PHP source of articles/net-bpf.php. (This encourages him to write clean, easy-to-understand code...well, relatively clean and easy-to-understand, that is.) If you become interested in PHP, you can read more about it at PHP: Hypertext Preprocessor. You will also see plenty of HTML code, which is what makes the World Wide Web go 'round. You can read more about HTML (and CSS, another technology used on this site) here, at the official page of the very official World Wide Web Consortium (W3C). Anyway, enough rambling, here's the code!


<?php include("../header1.php"); ?>
<?php $THIS_FILE 
"articles/net-bpf.php"?>
  <title>Jeff T.'s FAQ: No /usr/include/net/bpf.h header in Linux</title>
<?php include("../header2.php"); ?>
<?php 
include("localheader.php"); ?>

  <h1>No /usr/include/net/bpf.h header in Linux</h1>

  <h3>Setup</h3>
  <p>I am on a Gentoo Linux machine running a 2.6.10 kernel.  I believe I ran into this problem while trying to compile <code><a href="http://www.tcpdump.org/related.html">tcpslice</a></code>.  However, I gather from googling that many other Linux distributions and network-related tools (such as <code><a href="http://www.ethereal.com/">ethereal</a></code>) are affected.</p>

  <h3>Symptoms</h3>
  <p>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 <code>#include &lt;net/bpf.h&gt;</code> line because it couldn't find the header file.</p>

  <h3>Background</h3>
  <p>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, <code><a href="http://www.tcpdump.org/">libpcap</a></code> provides a compatible header.</p>

  <h3>Resolution</h3>
  <p>Install libpcap, using whatever means necessary.  Then simply:</p>

  <p><code>cp /usr/include/pcap-bpf.h /usr/include/net/bpf.h</code></p>

<?php include("../footer.php"); ?>
viewsource.php: Last Modified: 08/13/07@20:34:26 | Size: 2780 bytes | View Source