Bug 54161 - libpcap hangs if no filter set, pcap_next loses every other packet
Summary: libpcap hangs if no filter set, pcap_next loses every other packet
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: tcpdump   
(Show other bugs)
Version: 7.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Harald Hoyer
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-09-29 06:57 UTC by Alexander Dupuy
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-10-01 09:45:44 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
test program to demonstrate bug (& partial workaround), patch to libpcap (2.99 KB, patch)
2001-09-29 07:01 UTC, Alexander Dupuy
no flags Details | Diff

Description Alexander Dupuy 2001-09-29 06:57:45 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.78 [en] (X11; U; Linux 2.4.9 i686)

Description of problem:
When using the PACKET_RX_RING interface, poll() on the packet fd will never
succeed if there is no kernel BPF filter installed.
Due to a fencepost error in packet_ring_recv, the pcap_dispatch and
pcap_loop interfaces will actually receive one more packet than requested. 
The pcap_next function, which only returns one packet, effectively loses
the first one.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. write a program that uses libpcap but doesn't set a filter
2. write a program that loops calling pcap_next and prints destination
address of packet
3. run the programs and compare output to that of "tcpdump -nes 1"


Actual Results:  the first program never prints anything
the second program only prints every other packet

Expected Results:  the programs should print lines for every packet

Additional info:

Comment 1 Alexander Dupuy 2001-09-29 07:01:55 UTC
Created attachment 32998 [details]
test program to demonstrate bug (& partial workaround), patch to libpcap

Comment 2 Harald Hoyer 2002-01-17 15:26:33 UTC
should be fixed in 3.6.2-10 or newer



Note You need to log in before you can comment on or make changes to this bug.