RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 731789 - Bug with snaplen in libpcap
Summary: Bug with snaplen in libpcap
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libpcap
Version: 6.1
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Michal Sekletar
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-08-18 16:41 UTC by fabrizio.giordano
Modified: 2013-11-21 23:54 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: libpcap is unable to open a capture device with small snaplen. Consequence: libpcap returns error when trying to open capture device with snaplen less than 13 and it causes tcpdump to exit prematurely. Fix: Calculation of frames for memory mapping packet capture mechanism was adjusted in a way that in doesn't truncate packets to smaller values than actual snaplen. Result: libpcap doesn't return error when trying to open capture device with small values of snaplen and applications using libpcap are processing packets normally instead of exiting with error.
Clone Of:
Environment:
Last Closed: 2013-11-21 23:54:54 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Test Application (4.15 KB, text/plain)
2011-08-18 16:41 UTC, fabrizio.giordano
no flags Details
libpcap-linux-snaplen-mmap.patch (3.43 KB, patch)
2011-08-24 16:59 UTC, fabrizio.giordano
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1727 0 normal SHIPPED_LIVE libpcap bug fix and enhancement update 2013-11-20 21:51:25 UTC

Description fabrizio.giordano 2011-08-18 16:41:12 UTC
Created attachment 518906 [details]
Test Application

Description of problem:

I have Scientific Linux 6.0 on my machine and apparently the version of libpcap that's distributed with it (libpcap-1.0.0-6.20091201git117cb5.el6.x86_64) has a bug when opening a device with a snaplen smaller than 13.
Besides, even if the snaplen is greater or equal to 13, the captured packet size won't match the selected snaplen.
 
The following message will be displayed when reading from a device that's been opened with a snaplen < 13:

"Error reading the packets: corrupted frame on kernel ring mac offset 70 +
caplen 0 > frame len 64"
 
Apparently these two bugs have already been fixed in the latest version of libpcap.
I attached a test application to show what I described.

Version-Release number of selected component (if applicable):
libpcap-1.0.0-6.20091201git117cb5.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. FIRST_TEST: Open an interface with pcap_open_live setting a snaplen < 13, then read packets.
2. SECOND_TEST: Open an interface with pcap_open_live setting a snaplen >=13, read packets and check that the snaplen is the same as set in pcap_open_live
  
Actual results:
1. The message "Error reading the packets: corrupted frame on kernel ring mac offset 70 + caplen 0 > frame len 64" will appear
2. The length of the captured packets won't be the same as set in pcap_open_live

Expected results:
1. Read packets normally
2. The length of the packets should match the snaplen set in pcap_open_live

Comment 2 RHEL Program Management 2011-08-18 17:08:53 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 3 Michal Sekletar 2011-08-24 11:01:22 UTC
Hello Fabrizio, 

thank you for reporting this issue. I've confirmed that it is actual bug in libpcap but after some further investigation I've found out that there is no straightforward way to backport a patch which solves this issue. There has been just too much development and changes done since version 1.0.0. As you correctly pointed out this issue is now resolved in the latest development version of libpcap. I hope that this issue will be solved in some upcoming major release of Red Hat Enterprise Linux by upgrading to new version of libpcap.

Michal Sekletar

Comment 4 fabrizio.giordano 2011-08-24 16:59:30 UTC
Created attachment 519671 [details]
libpcap-linux-snaplen-mmap.patch

We actually managed to create a patch from the git repository that fixed this bug. This is the commit that fixed the bug:

https://github.com/mcr/libpcap/commit/9982024b5718fac524d8c637329206ea80d7b8ad

Comment 5 Michal Sekletar 2011-08-29 07:47:34 UTC
Hi,

thank you for your patch and please excuse my mistake.

Michal Sekletar

Comment 6 Guy Harris 2011-12-09 09:09:47 UTC
This might be fixed in 1.2.0; if not, it's fixed in the top of the 1.2 branch and the trunk, so it'll be fixed in the next release.  (The Linux mmapping code gives me a pain where a pill can't reach it; as per my comment in another bug, maybe TPACKET_V3 will be less painful to work with.)

Comment 8 Suzanne Logcher 2012-02-14 23:13:49 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 9 RHEL Program Management 2012-09-07 05:09:06 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.

Comment 11 Michal Sekletar 2013-08-28 15:00:03 UTC
This issue should be solved by rebase of libpcap in rhel-6.5.

http://bulk-mail.corp.redhat.com/archives/cvs-commits-list/2013-August/msg09611.html

Comment 14 errata-xmlrpc 2013-11-21 23:54:54 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1727.html


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