]> git.baikalelectronics.ru Git - kernel.git/commit
rds: tcp: Set linger when rejecting an incoming conn in rds_tcp_accept_one
authorSowmini Varadhan <sowmini.varadhan@oracle.com>
Thu, 15 Jun 2017 18:28:55 +0000 (11:28 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 Jun 2017 16:45:15 +0000 (12:45 -0400)
commit6ef5b48a6e926d8a7119bd8ad8dd2e78d753903c
tree65fc470f7f2ab3c73c3d3bfd46caa3473098e68e
parent0af155a0426b31b18342e9c8d926bd1198c8cdd0
rds: tcp: Set linger when rejecting an incoming conn in rds_tcp_accept_one

Each time we get an incoming SYN to the RDS_TCP_PORT, the TCP
layer accepts the connection and then the rds_tcp_accept_one()
callback is invoked to process the incoming connection.

rds_tcp_accept_one() may reject the incoming syn for a number of
reasons, e.g., commit 0cb72ffb9cb3 ("RDS: TCP: Force every connection
to be initiated by numerically smaller IP address"), or because
we are getting spammed by a malicious node that is triggering
a flood of connection attempts to RDS_TCP_PORT. If the incoming
syn is rejected, no data would have been sent on the TCP socket,
and we do not need to be in TIME_WAIT state, so we set linger on
the TCP socket before closing, thereby closing the socket efficiently
with a RST.

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Tested-by: Imanti Mendez <imanti.mendez@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rds/tcp_listen.c