Package: wireshark-common
Version: 1.0.2-3+lenny4
Severity: normal
File: /usr/bin/dumpcap
Tags: patch

When dumpcap is interrupted with ^C it erroneously believes a packet
capturing error has occurred:

  # dumpcap
  File: /tmp/etherXXXXbg3xVx
  Packets: 44 ^CError while capturing packets: 
  Please report this to the Wireshark developers.
  (This is not a crash; please do not report it as such.)
  Packets: 59 Packets dropped: 0

The problem is a failure to properly check the return value from
pcap_dispatch().  The attached patch corrects this problem.


-- System Information:
Debian Release: 5.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages wireshark-common depends on:
ii  libadns1              1.4-2              Asynchronous-capable DNS client li
ii  libc6                 2.7-18             GNU C Library: Shared libraries
ii  libcap2               2.11-2             support for getting/setting POSIX.
ii  libcomerr2            1.41.3-1           common error description library
ii  libgcrypt11           1.4.1-1            LGPL Crypto library - runtime libr
ii  libglib2.0-0          2.16.6-1           The GLib library of C routines
ii  libgnutls26           2.4.2-6+lenny1     the GNU TLS library - runtime libr
ii  libkrb53              1.6.dfsg.4~beta1-5 MIT Kerberos runtime libraries
ii  liblua5.1-0           5.1.3-1            Simple, extensible, embeddable pro
ii  libpcap0.8            0.9.8-5            system interface for user-level pa
ii  libpcre3              7.6-2.1            Perl 5 Compatible Regular Expressi
ii  zlib1g                1:1.2.3.3.dfsg-12  compression library - runtime

Versions of packages wireshark-common recommends:
ii  tshark                    1.0.2-3+lenny4 network traffic analyzer (console)
ii  wireshark                 1.0.2-3+lenny4 network traffic analyzer

wireshark-common suggests no packages.

-- no debconf information
>From 30fcd744088ca92dd8a6a2bd49c9ef662c4d6644 Mon Sep 17 00:00:00 2001
From: Rob Leslie <r...@mars.org>
Date: Wed, 4 Mar 2009 15:48:04 -0800
Subject: [PATCH] Fix dumpcap believing error on ^C i.e. pcap_breakloop()

When ^C was pressed during a packet capture, dumpcap believed a pcap
error had occurred.  We check the return value more closely to avoid
this problem.
---
 dumpcap.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/dumpcap.c b/dumpcap.c
index b052f59..aaebc7b 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -1511,7 +1511,10 @@ capture_loop_dispatch(capture_options *capture_opts _U_, 
loop_data *ld,
         inpkts = pcap_dispatch(ld->pcap_h, 1, capture_loop_packet_cb,
                                (u_char *)ld);
         if (inpkts < 0) {
-          ld->pcap_err = TRUE;
+         if (inpkts == -1) {
+           /* Error, rather than pcap_breakloop(). */
+           ld->pcap_err = TRUE;
+         }
           ld->go = FALSE; /* error or pcap_breakloop() - stop capturing */
         }
       } else {
-- 
1.6.0.2.GIT

Reply via email to