Bug 158635 - [em] TSO breaks BPF packet captures with em driver
Summary: [em] TSO breaks BPF packet captures with em driver
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-04 14:20 UTC by Christopher Key
Modified: 2017-12-31 22:32 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Key 2011-07-04 14:20:08 UTC
When using the em driver, any packets sent that use TCP segmentation
offload (TSO) and that are captured through the Berkeley Packet Filter
(BPF) will have a packet length of zero.  This affects many applications,
e.g. iftop shows zero upload bandwidth, tcpdump reports "IP bad-len 0".
The same problem may affect network drivers other than em, but this has
not been tested.

Fix: 

A trivial workaround is,
ifconfig emX -tso
but this clearly removes the benefits provided by TSO.

There seems to be many possible solutions:

1) em should massage the data supplied to bpf to pretend one large
   packet was sent
2) em should massage the data supplied to bpf to supply data as it is
   assumed the hardware will segment it
3) BPF should detect TSO packets, and massage the data to supply a
   valid length
4) BPF clients should detect TSO packets and behave accordingly
5) BPF and TSO are mutually incompatible, and BPF should disable/
   re-enable TSO when starting/stopping a capture
6) BPF and TSO are mutually incompatible, and BPF clients should emit
   a warning where appropriate
7) BPS and TSO are mutually incompatible, users should know this, and
   nothing need be done

Which of these is most appropriate seems to depend on where BPF sits,
conceptually, within the stack: whether it's supposed to report what
the upper layers supply to the interface driver, what actually comes
out of the physical interface, or something in between; and how much
effort it appropriate to make to supply the 'correct' data for this
location to BPF clients.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2011-07-06 22:53:02 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-net

Over to maintainer(s).
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:33 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped