NetBSD Problem Report #41326

From www@NetBSD.org  Fri May  1 21:13:32 2009
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id D562463C131
	for <gnats-bugs@gnats.netbsd.org>; Fri,  1 May 2009 21:13:31 +0000 (UTC)
Message-Id: <20090501211331.944C463B8A5@www.NetBSD.org>
Date: Fri,  1 May 2009 21:13:31 +0000 (UTC)
From: mmayer@redback.com
Reply-To: mmayer@redback.com
To: gnats-bugs@NetBSD.org
Subject: libpcap error message not printing useful information
X-Send-Pr-Version: www-1.0

>Number:         41326
>Category:       lib
>Synopsis:       libpcap error message not printing useful information
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 01 21:15:00 +0000 2009
>Closed-Date:    Mon Nov 10 20:48:46 +0000 2025
>Last-Modified:  Mon Nov 10 20:48:46 +0000 2025
>Originator:     Markus Mayer
>Release:        HEAD
>Organization:
Ericsson / Redback
>Environment:
>Description:
In two cases, libpcap will say that link-layer type "linktype" is not supported. However, "linktype" is always -1 at this point. Therefore, the error message will always complain about link-layer type -1 being unsupported.

It would be more helpful if "p->linktype" were being used instead of "linktype" in these two snprintf() calls.

>How-To-Repeat:

>Fix:
Index: savefile.c
===================================================================
RCS file: /cvsroot/src/dist/libpcap/savefile.c,v
retrieving revision 1.2
diff -u -r1.2 savefile.c
--- savefile.c  27 Feb 2006 15:55:30 -0000      1.2
+++ savefile.c  1 May 2009 21:12:39 -0000
@@ -1220,7 +1220,7 @@
        if (linktype == -1) {
                snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "%s: link-layer type %d isn't supported in savefiles",
-                   fname, linktype);
+                   fname, p->linktype);
                return (NULL);
        }

@@ -1254,7 +1254,7 @@
        if (linktype == -1) {
                snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "stream: link-layer type %d isn't supported in savefiles",
-                   linktype);
+                   p->linktype);
                return (NULL);
        }


>Release-Note:

>Audit-Trail:
From: Guy Harris <gharris@sonic.net>
To: "gnats-bugs@netbsd.org" <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: lib/41326
Date: Mon, 10 Nov 2025 11:49:43 -0800

 NetBSD's libpcap now tracks tcpdump.org's libpcap, and has picked up its =
 fix for this. (See sf-pcap.c; that's where the code in question is now.) =
 This issue can be closed.=

State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Mon, 10 Nov 2025 20:48:46 +0000
State-Changed-Why:
Fixed by merging from upstream, thanks for the update!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.