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.
This bugfix is also available as a github Pull Request: https://github.com/freebsd/freebsd/pull/12
Thanks for your submission. https://svnweb.freebsd.org/base?view=revision&revision=306458