tcpdump mailing list archives
Re: segfault in pcap_snapshot
From: Guy Harris <gharris () sonic net>
Date: Sun, 22 Feb 2004 14:58:11 -0800
On Sun, Feb 22, 2004 at 11:35:21PM +0100, Karl Sjödahl wrote:
if(pcap_open_live(device, BUFSIZ, PROMISC, 0, errbuf) == -1) { error handling }
"pcap_open_live()" doesn't return an integer, it returns a "pcap_t *" on success, and NULL on failure; the "pcap_t *" is what you have to use in subsequent calls to "pcap_compile()", "pcap_setfilter()", "pcap_dispatch()"/"pcap_loop()"/"pcap_next()", etc.. Thus, that call should be p = pcap_open_live(device, BUFSIZ, PROMISC, 0, errbuf); if (p == NULL { error handling } and that "p" (which should be a "pcap_t *") is what should be used in subsequent calls such as
if(pcap_compile(p, &filter_code, TESTFILTER, 0, netmask) == -1) { error handling } if(pcap_setfilter(p, &filter_code) == -1) { error handling }
- 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:
- segfault in pcap_snapshot Karl Sjödahl (Feb 22)
- Re: segfault in pcap_snapshot Guy Harris (Feb 22)
- SV: segfault in pcap_snapshot Karl Sjödahl (Feb 22)
- Re: segfault in pcap_snapshot Guy Harris (Feb 22)