tcp/sack: Cleanup the SACK related bits when return from tcp_input slow path
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 6 Apr 2012 01:47:36 +0000 (09:47 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Wed, 11 Apr 2012 01:43:09 +0000 (09:43 +0800)
commitd58ca578df67fe1215272bb28a52225b231314fd
treefc12b6fa246b74a413dad50edba9f36800eaf336
parent3a5d999bd2fedb7e7e52153a00e267a20bd9e57a
tcp/sack: Cleanup the SACK related bits when return from tcp_input slow path

When the code path that could generate the invalid SACK block on out-of-order
FIN segment was walked through, it turned out that some SACK related bits
could be leftover from the previous input segment, e.g. SACKLEFT.

Since the observed invalid SACK option contains only one SACK block and the
block's right edge is same as its left edge, the code which can generate that
SACK block could be run only if SACKLEFT is turned on and reportblk's start
and end are same.
- If SACKLEFT is on then reportblk's start and end must not be same, so the
  SACKLEFT is leftover from the previous input segment.
- If KASSERTs about the clearance of the SACK bits are added immediately
  before returning from the tcp_input slow path, the KASSERTs could fail due
  to SACKLEFT are still on.

Obviously the SACK related bits are never intended to be inheritted from one
input segment to another input segment, so we just clear them before returning
from the tcp_input slow path.
sys/netinet/tcp_input.c
sys/netinet/tcp_sack.c
sys/netinet/tcp_var.h