Bug 194697 - incoming IP TOS bits get zeroed on mbufs that need checksumming
Summary: incoming IP TOS bits get zeroed on mbufs that need checksumming
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-net (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2014-10-29 23:15 UTC by Sebastian Kuzminsky
Modified: 2017-01-06 00:34 UTC (History)
1 user (show)

See Also:


Attachments
save & restore IP TOS field when computing TCP checksum (748 bytes, text/plain)
2014-10-29 23:15 UTC, Sebastian Kuzminsky
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Kuzminsky 2014-10-29 23:15:44 UTC
Created attachment 148780 [details]
save & restore IP TOS field when computing TCP checksum

On mbufs that don't have the CSUM_DATA_VALID flag set, tcp_input() needs to compute the TCP checksum itself.

The TCP checksum includes some but not all fields from the IP header.

tcp_input() zeroes the fields of the IP header that are not to be included in the checksum, then checksums the entire packet (IP header, TCP header, and TCP data), then restores the IP header fields it will need later.

The bug is that the IP TOS field was not restored, so the later read of it returned a zeroed byte instead of the incoming packet's actual TOS value.

The attached patch contains a suggested fix that resolves the issue for me.
Comment 1 Sebastian Kuzminsky 2014-10-29 23:16:26 UTC
This bugfix is also available as a github Pull Request:

https://github.com/freebsd/freebsd/pull/12
Comment 2 Hiren Panchasara freebsd_committer freebsd_triage 2017-01-06 00:34:03 UTC
Thanks for your submission.
https://svnweb.freebsd.org/base?view=revision&revision=306458