tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: BSD doesn't track window size changes correctly.

I haven't paid much attention to TCP recently so I'm not sure how this
is supposed to work, but it seems like the problem is clear(?).  I notice
below that NetBSD is using a window scale of 5, so this packet

> 09:03:38.112052 IP NetBSD.ssh > FreeBSD.35421: Flags [.], ack 238424, win 39, 
> options [nop,nop,TS val 249 ecr 1076464], length 0

ack's to 238424 and advertises a window of 39*32=1248 bytes, so its window
is open out to sequence 238424+1248=239672.  FreeBSD seems to believe this
too since it sends this short packet

> 09:03:38.223740 IP FreeBSD.35421 > NetBSD.ssh: Flags [.], seq 239664:239672, 
> ack 4436931, win 8280, options [nop,nop,TS val 1076502 ecr 249,nop,nop,sack 1 
> {4438371:4439811}], length 8

which completely fills the advertised window out to sequence 239672.  The
problem seems to be that here

> 09:03:38.416891 IP NetBSD.ssh > FreeBSD.35421: Flags [.], ack 239664, win 0, 
> options [nop,nop,TS val 249 ecr 1076479], length 0

NetBSD, having previously advertised that its window was open to 239672, now
claims that its window closed at sequence 239664 while apparently chucking
FreeBSD's last 8 bytes.  FreeBSD should ignore this since NetBSD shouldn't
be shrinking its window from a previously advertised size.  The problem, then,
isn't FreeBSD ignoring the closed window but rather NetBSD not accepting those
last 8 bytes.

I'm pretty sure the problem has something to do with window scaling, but I've
not paid attention to how this is supposed to work.  What is clear is that
with a wscale of 5 NetBSD can't specify the right hand edge of its window
with a precision better than 32 bytes, so the edge it advertises is going to
vary by <32 bytes from acknowledgement to acknowledgement.  This being the
case, NetBSD should have accepted data out to the maximum sequence it has
ever advertised as being willing to accept.  If NetBSD is trying to keep
within the precise limit of some internal buffer it needs to make very sure
that it always rounds the window size it advertises down from that.  NetBSD
should have accepted the last 8 bytes it was sent.

Dennis Ferguson

Home | Main Index | Thread Index | Old Index