Page MenuHomeFreeBSD

tcp_output: Clear FIN if tcp_m_copym truncates output length
AcceptedPublic

Authored by jhb on Fri, Sep 27, 9:34 PM.
Tags
None
Referenced Files
F97576153: D46824.id143828.diff
Mon, Sep 30, 3:55 AM
F97531869: D46824.diff
Sun, Sep 29, 10:33 PM
Unknown Object (File)
Sat, Sep 28, 2:31 PM

Details

Reviewers
glebius
gallatin
rscheff
tuexen
Group Reviewers
transport
Summary

Sponsored by: Chelsio Communications

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 59636
Build 56523: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Fri, Sep 27, 9:34 PM

I tripped over this while doing some internal testing of NIC TLS where I used a hack in tcp_m_copym() that forces truncations in the middle of TLS trailers and I tripped over an assertion that a truncated TLS record can't be transmitted with FIN. Other places in tcp_output() that truncate the length clear TH_FIN as well. Possibly the change to clear tso could also go inside this check, but that would be a larger diff.

rscheff added subscribers: tuexen, cc, rrs, rscheff.

Good find! While there is probably zero difference as the compiler optimizes this, keeping "old_len" instead would only require the clearing of TH_FIN, and not another assignment though, which seems more alike to similar other checks... @tuexen @cc and @rrs may want to have a look too...

This revision is now accepted and ready to land.Sun, Sep 29, 12:51 PM

Good find! While there is probably zero difference as the compiler optimizes this, keeping "old_len" instead would only require the clearing of TH_FIN, and not another assignment though, which seems more alike to similar other checks... @tuexen @cc and @rrs may want to have a look too...

I agree with Richard. Something like:

uint32_t old_len;
...
old_len = len;
m->m_next = tcp_m_copym(mb, moff,
    &len, if_hw_tsomaxsegcount,
    if_hw_tsomaxsegsize, msb, hw_tls);
if (old_len != len)
	 flags &= ~TH_FIN;

But I leave it up to you.