From owner-freebsd-bugs Tue Oct 30 19:40: 8 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id D255E37B405 for ; Tue, 30 Oct 2001 19:40:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f9V3e1060489; Tue, 30 Oct 2001 19:40:01 -0800 (PST) (envelope-from gnats) Received: from topaz.mdcc.cx (topaz.mdcc.cx [212.204.230.141]) by hub.freebsd.org (Postfix) with ESMTP id 01B1637B401 for ; Tue, 30 Oct 2001 19:33:43 -0800 (PST) Received: from k7.mavetju.org (topaz.mdcc.cx [212.204.230.141]) by topaz.mdcc.cx (Postfix) with ESMTP id 297512B697 for ; Wed, 31 Oct 2001 04:33:39 +0100 (CET) Received: by k7.mavetju.org (Postfix, from userid 1001) id C1959B4; Wed, 31 Oct 2001 14:33:35 +1100 (EST) Message-Id: <20011031033335.C1959B4@k7.mavetju.org> Date: Wed, 31 Oct 2001 14:33:35 +1100 (EST) From: Edwin Groothuis Reply-To: Edwin Groothuis To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: bin/31649: libpcap doesn't work with -pthread Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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 #include #include #include #include #include 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