Page MenuHomeFreeBSD

tcp: cleanup syncache_expand()
ClosedPublic

Authored by tuexen on Wed, Oct 1, 9:01 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 9, 12:26 PM
Unknown Object (File)
Thu, Oct 9, 12:26 PM
Unknown Object (File)
Thu, Oct 9, 12:26 PM
Unknown Object (File)
Thu, Oct 9, 11:57 AM
Unknown Object (File)
Wed, Oct 1, 5:26 PM
Unknown Object (File)
Wed, Oct 1, 1:12 PM
Unknown Object (File)
Wed, Oct 1, 12:06 PM
Unknown Object (File)
Wed, Oct 1, 11:41 AM

Details

Summary

Only validate SEG.SEQ and SEG.ACK when processing a real SYN-cache entry. In the SYN-cookie case, these conditions are always true, since the SYN-cache entry on the stack is constructed from the incoming TCP segment.
While there, fix the logging messages.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tuexen requested review of this revision.Wed, Oct 1, 9:01 AM
tuexen edited the summary of this revision. (Show Details)

This change looks good to me, though I personally prefer to the more verbose comments before you shortened them. But I wouldn't block on that.

One comment about the preexisting pattern here: requiring every failure path to individually unlock is error prone IMHO, as well as having a mix of return and goto. There's already a locked variable too. I don't think a single exit point with the cleanup would be too hard to add... just a thought.

This revision is now accepted and ready to land.Wed, Oct 1, 11:58 AM

I agree with Nick that previous comments were better.
You may add assertions that match the checks in the syncookie_expand() case.

Also, I'm not sure "not a functional change" applies in the commit message. TCP wise there is no change, but code wise there is.

P.S. Interesting that the email generator of phabricator produced a much easier diff to read than the web version.

This change looks good to me, though I personally prefer to the more verbose comments before you shortened them. But I wouldn't block on that.

OK. Moving the checks to the proper place is the first step. The second step will be to do the right action, which is sending a challenge ACK instead of killing the entry. When writing the comments for the second step, I will expand the variable names again.

One comment about the preexisting pattern here: requiring every failure path to individually unlock is error prone IMHO, as well as having a mix of return and goto. There's already a locked variable too. I don't think a single exit point with the cleanup would be too hard to add... just a thought.

Once we have the right functionality, we can cleanup the function. I just did not wanted to mix these things up.

I agree with Nick that previous comments were better.

I can expand the variable names. But I would like to be consistent in stating what is tested: in one test SEG.SEQ, and in the other SEG.ACK.

You may add assertions that match the checks in the syncookie_expand() case.

I will take this into account when the code is doing the actions it should.

Also, I'm not sure "not a functional change" applies in the commit message. TCP wise there is no change, but code wise there is.

That is not there anymore...

P.S. Interesting that the email generator of phabricator produced a much easier diff to read than the web version.

I totally agree....

This revision was automatically updated to reflect the committed changes.