summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_input.c
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1998-05-18 16:12:13 +0000
committerwpaul <wpaul@FreeBSD.org>1998-05-18 16:12:13 +0000
commite50ecde61b58719278311e5263d7a7d121e43c33 (patch)
treecb141f2330f2e5f488adb26943c138910b970379 /sys/netinet/tcp_input.c
parent3620341ce9b1059b839e53c1dd529116f970a036 (diff)
downloadFreeBSD-src-e50ecde61b58719278311e5263d7a7d121e43c33.zip
FreeBSD-src-e50ecde61b58719278311e5263d7a7d121e43c33.tar.gz
Improve DoS avoidance in RPC stream oriented transports. The TCP transport
uses readtcp() to gather data from the network; readtcp() uses select(), with a timeout of 35 seconds. The problem with this is that if you connect to a TCP server, send two bytes of data, then just pause, the server will remain blocked in readtcp() for up to 35 seconds, which is sort of a long time. If you keep doing this every 35 seconds, you can keep the server occupied indefinitely. To fix this, I modified readtcp() (and its cousin, readunix() in svc_unix.c) to monitor all service transport handles instead of just the current socket. This allows the server to keep handling new connections that arrive while readtcp() is running. This prevents one client from potentially monopolizing a server. Also, while I was here, I fixed a bug in the timeout calculations. Someone attempted to adjust the timeout so that if select() returned EINTR and the loop was restarted, the timeout would be reduced so that rather than waiting for another 35 seconds, you could never wait for more than 35 seconds total. Unfortunately, the calculation was wrong, and the timeout could expire much sooner than 35 seconds.
Diffstat (limited to 'sys/netinet/tcp_input.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud