Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 May 2010 17:48:15 GMT
From:      Boris <spawk@acm.poly.edu>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/146592: [PATCH] libpcap 1.0.0 doesn't have error message for nonexistent interface
Message-ID:  <201005141748.o4EHmFGw050757@www.freebsd.org>
Resent-Message-ID: <201005141750.o4EHo4HC035429@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         146592
>Category:       misc
>Synopsis:       [PATCH] libpcap 1.0.0 doesn't have error message for nonexistent interface
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 14 17:50:03 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Boris
>Release:        8.0-RELEASE-p2
>Organization:
Kochergin
>Environment:
FreeBSD peer 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #2: Mon Feb 22 23:18:53 EST 2010     root@peer:/usr/obj/usr/src/sys/PEER  i386
>Description:
libpcap 1.0.0, found in FreeBSD 8.0 and CURRENT, does not notify a user if the device they tried to open (via BPF) does not exist. With older versions, one gets:

# tcpdump -i something
tcpdump: BIOCSETIF: no: Device not configured

With 1.0.0, one gets:

# tcpdump -i something
tcpdump: 

The current version of libpcap, 1.1.1, fixes the problem, but I don't know if there are plans to incorporate it into the base system anytime soon. The attached patch fixes the problem in libpcap 1.0.0.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- /usr/src/contrib/libpcap/pcap-bpf.c.orig	2010-05-14 13:20:41.000000000 -0400
+++ /usr/src/contrib/libpcap/pcap-bpf.c	2010-05-14 13:35:31.000000000 -0400
@@ -1601,6 +1601,14 @@
 
 				if (errno != ENOBUFS) {
 					status = check_setif_failure(p, errno);
+					if (errno == ENXIO) {
+						snprintf(p->errbuf,
+						    PCAP_ERRBUF_SIZE,
+						    "BIOCSETIF: %s: %s",
+						    p->opt.source,
+						    pcap_strerror(errno));
+						status = PCAP_ERROR_NO_SUCH_DEVICE;
+					}
 					goto bad;
 				}
 			}


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005141748.o4EHmFGw050757>