Date: Wed, 31 Oct 2001 14:33:35 +1100 (EST) From: Edwin Groothuis <edwin@mavetju.org> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/31649: libpcap doesn't work with -pthread Message-ID: <20011031033335.C1959B4@k7.mavetju.org>
next in thread | raw e-mail | index | archive | help
>Number: 31649 >Category: bin >Synopsis: libpcap doesn't work with -pthread >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Oct 30 19:40:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Edwin Groothuis >Release: FreeBSD 4.4-RELEASE i386 >Organization: - >Environment: System: FreeBSD k7.mavetju.org 4.4-RELEASE FreeBSD 4.4-RELEASE #0: Thu Oct 4 08:49:05 EST 2001 edwin@k7.mavetju.org:/usr/src/sys/compile/k7 i386 A normal 4.4 machine, build from the distribution cdrom >Description: When compiling a program which listens to a network device via the pcap-library with -pthread, it stops working in the pcap_loop() bits. >How-To-Repeat: #include <pcap.h> #include <net/bpf.h> #include <stdlib.h> #include <string.h> #include <signal.h> #include <sys/ioctl.h> pcap_t *pd = NULL; char *dev = "fxp0"; int link_offset; int link_type; int snaplen = 65535, promisc = 1, to = 1000; char pc_err[PCAP_ERRBUF_SIZE]; void networkinit(void) { if ((pd = pcap_open_live(dev, snaplen, promisc, to, pc_err)) == NULL) { perror(pc_err); exit(-1); } } void process(u_char *data1, struct pcap_pkthdr* h, u_char *p) { fprintf(stderr,"."); } void networkrun(void) { while (pcap_loop(pd, 0, (pcap_handler)process, 0)); exit(-2); } int main(void) { networkinit(); networkrun(); } (You might have to tweak the fxp0 in the dev-variable) Compile as "gcc -Wall -o nw nw.c -lpcap". It will print a dot for every IP packet. Compile as "gcc -Wall -o nw nw.c -lpcap -pthread". It will print nothing. >Fix: none known. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011031033335.C1959B4>