Project

General

Profile

Actions

Bug #1674

closed

non-blocking BPF reads return -1/EWOULDBLOCK until the store buffer fills up

Added by guy almost 15 years ago. Updated almost 15 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

Non-blocking reads from a BPF device not in immediate mode will not rotate the buffers even if there's data in the store buffer but not in the hold buffer, so, until the store buffer fills up, the reads will return -1 and set errno to EWOULDBLOCK.

To reproduce, compile the attached (C++) program, run it on an adapter with the filter "icmp" on a reasonably quiet network, and then, on the same machine, ping some host the pings to which will go out on the same network. Note that the program doesn't report any packets having been seen.

To fix, apply the attached patch. (A similar bug has been filed against FreeBSD - and will be filed against Mac OS X.)


Files

libpcaptest.cpp (4.6 KB) libpcaptest.cpp guy, 02/13/2010 08:51 AM
unnamed (2 Bytes) unnamed guy, 02/13/2010 08:51 AM
patch.txt (652 Bytes) patch.txt guy, 02/13/2010 08:51 AM
Actions

Also available in: Atom PDF