SYN/ACK delays and 139/445

tridge at tridge at
Tue Oct 25 11:49:22 GMT 2005


As discussed on IRC, what windows seems to do for SMB connections is

  - fire off a SYN on 445
  - start a 1 millisecond timer
  - if 445 connect succeeds, then all done
  - wait for timer to fire
  - on timer start the 139 connect

This gives predictable choice of 445 if possible, which is nice
(non-deterministic behaviour in client libs is nasty) and avoids the
long SYN/ACK wait when 445 is blackholed by a firewall.

The one thing windows seems to do wrong is that if port 445 gives a
RST then it still waits for the 1 millisecond timer to expire before
trying the 139 connect. That's a bug, but a fairly minor one. It just
means that for servers with 445 not listening there is a needless 1 ms

This should be pretty easy to implement right with our events
code. We'll just need to be careful to handle the case where the
network is a bit slow, and we end up with both ports connected.  That
will be tricky to test, so it will need to be coded carefully to
ensure we don't leak a fd.

Cheers, Tridge

More information about the samba-technical mailing list