Skip to content

Commit 4ce7e93

Browse files
Eric Dumazetdavem330
authored andcommitted
tcp: rate limit ACK sent by SYN_RECV request sockets
Attackers like to use SYNFLOOD targeting one 5-tuple, as they hit a single RX queue (and cpu) on the victim. If they use random sequence numbers in their SYN, we detect they do not match the expected window and send back an ACK. This patch adds a rate limitation, so that the effect of such attacks is limited to ingress only. We roughly double our ability to absorb such attacks. Signed-off-by: Eric Dumazet <[email protected]> Cc: Willem de Bruijn <[email protected]> Cc: Neal Cardwell <[email protected]> Cc: Maciej Żenczykowski <[email protected]> Acked-by: Neal Cardwell <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a9d6532 commit 4ce7e93

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

net/ipv4/tcp_minisocks.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,10 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
704704
if (paws_reject || !tcp_in_window(TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq,
705705
tcp_rsk(req)->rcv_nxt, tcp_rsk(req)->rcv_nxt + req->rsk_rcv_wnd)) {
706706
/* Out of window: send ACK and drop. */
707-
if (!(flg & TCP_FLAG_RST))
707+
if (!(flg & TCP_FLAG_RST) &&
708+
!tcp_oow_rate_limited(sock_net(sk), skb,
709+
LINUX_MIB_TCPACKSKIPPEDSYNRECV,
710+
&tcp_rsk(req)->last_oow_ack_time))
708711
req->rsk_ops->send_ack(sk, skb, req);
709712
if (paws_reject)
710713
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_PAWSESTABREJECTED);

0 commit comments

Comments
 (0)