tcpdump mailing list archives

Re: small program compile failed when using pcap, "undefined reference to `pcap_set"


From: Guy Harris <guy () alum mit edu>
Date: Fri, 28 Nov 2003 20:01:32 -0800

On Thu, Nov 27, 2003 at 11:00:02PM +0000, Arthur Chen wrote:
pcap_set_datalink(handle, DLT_PPP_ETHER);

That call will only work if either

        1) the link-layer type for the device is already DLT_PPP_ETHER

or

        2) you're running on a very recent version of FreeBSD or NetBSD
           (*maybe* FreeBSD 5.1 supports it, or maybe it's only 5.2,
           which isn't released yet, and the current CVS version of
           NetBSD supports it, but 1.6, as far as I know, doesn't) *AND*
           the device on which you're capturing supports DLT_PPP_ETHER
           as one of its link-layer types.

As you're running on Linux, 2) isn't the case, and 1) isn't the case
either, so that call will fail.  (You're not checking whether it
succeeds, so your program won't notice it.  You're not checking for
errors in any of the *other* calls you make, so your program could well
be getting errors from those calls without you knowing it, except for
incorrect behavior.)
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:tcpdump-workers-request () tcpdump org?body=unsubscribe


Current thread: