From owner-freebsd-bugs Sat Jan 6 13:30:13 2001 From owner-freebsd-bugs@FreeBSD.ORG Sat Jan 6 13:30:01 2001 Return-Path: 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 6FA0537B400 for ; Sat, 6 Jan 2001 13:30:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f06LU1V49526; Sat, 6 Jan 2001 13:30:01 -0800 (PST) (envelope-from gnats) Resent-Date: Sat, 6 Jan 2001 13:30:01 -0800 (PST) Resent-Message-Id: <200101062130.f06LU1V49526@freefall.freebsd.org> Resent-From: gnats-admin@FreeBSD.org (GNATS Management) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: gnats-admin@FreeBSD.org, archie@packetdesign.com Received: from mailman.packetdesign.com (dns.PACKETDESIGN.NET [216.15.46.10]) by hub.freebsd.org (Postfix) with ESMTP id CCF1037B400 for ; Sat, 6 Jan 2001 13:24:02 -0800 (PST) Received: from bubba.packetdesign.com (bubba.packetdesign.com [192.168.0.223]) by mailman.packetdesign.com (8.11.0/8.11.0) with ESMTP id f06LO1Q12938 for ; Sat, 6 Jan 2001 13:24:01 -0800 (PST) (envelope-from archie@packetdesign.com) Received: (from archie@localhost) by bubba.packetdesign.com (8.11.1/8.11.1) id f06LO2P12872; Sat, 6 Jan 2001 13:24:02 -0800 (PST) (envelope-from archie) Message-Id: <200101062124.f06LO2P12872@bubba.packetdesign.com> Date: Sat, 6 Jan 2001 13:24:02 -0800 (PST) From: Archie Cobbs Reply-To: archie@packetdesign.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/24116: libpcap error state not reset in pcap_compile_nopcap() Resent-Sender: gnats@FreeBSD.org Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 24116 >Category: bin >Synopsis: libpcap error state not reset in pcap_compile_nopcap() >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jan 06 13:30:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Archie Cobbs >Release: FreeBSD 4.2-RELEASE i386 >Organization: Packet Design, Inc. >Environment: FreeBSD -current and 4.2-REL >Description: When pcap_compile_nopcap() returns an error, subsequent compilations of valid input also (incorrectly) return an error. As a side note, there's no way to get the error string when pcap_compile_nopcap() is used because pcap_geterr() requires a pcap_t * which you don't have if you're using pcap_compile_nopcap(). So a feature request is that pcap_geterr() accept NULL as an argument and if so return the error from the most recent call to pcap_compile_nopcap(). >How-To-Repeat: Run this program: #include #include #include #include #include static char *tests[] = { "pcaptest", "tcp dst port 80", "udp dst host 1.1.1.1 and tcp port 80", "tcp dst port 80", }; int main(int ac, char **av) { struct bpf_program bpf; int i, r; if (ac < 2) { ac = sizeof(tests) / sizeof(*tests); av = tests; } memset(&bpf, 0, sizeof(bpf)); for (i = 1; i < ac; i++) { printf("Compiling \"%s\"\n", av[i]); r = pcap_compile_nopcap(ETHER_MAX_LEN - ETHER_HDR_LEN, DLT_RAW, &bpf, av[i], 1, ~0); if (r != 0) printf("--> Failed\n"); else printf("--> OK\n"); } return (0); } The third compilation should succeed, but it fails. >Fix: I'm going to work on this one myself but wanted to record it as a PR anyway. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message