Patch "netfilter: conntrack: connection timeout after re-register" has been added to the 5.8-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    netfilter: conntrack: connection timeout after re-register

to the 5.8-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     netfilter-conntrack-connection-timeout-after-re-regi.patch
and it can be found in the queue-5.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 690db2f22adaa30fc96a0beb9a66aa94a8c10514
Author: Francesco Ruggeri <fruggeri@xxxxxxxxxx>
Date:   Wed Oct 7 12:32:52 2020 -0700

    netfilter: conntrack: connection timeout after re-register
    
    [ Upstream commit 4f25434bccc28cf8a07876ef5142a2869a674353 ]
    
    If the first packet conntrack sees after a re-register is an outgoing
    keepalive packet with no data (SEG.SEQ = SND.NXT-1), td_end is set to
    SND.NXT-1.
    When the peer correctly acknowledges SND.NXT, tcp_in_window fails
    check III (Upper bound for valid (s)ack: sack <= receiver.td_end) and
    returns false, which cascades into nf_conntrack_in setting
    skb->_nfct = 0 and in later conntrack iptables rules not matching.
    In cases where iptables are dropping packets that do not match
    conntrack rules this can result in idle tcp connections to time out.
    
    v2: adjust td_end when getting the reply rather than when sending out
        the keepalive packet.
    
    Fixes: f94e63801ab2 ("netfilter: conntrack: reset tcp maxwin on re-register")
    Signed-off-by: Francesco Ruggeri <fruggeri@xxxxxxxxxx>
    Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index 1926fd56df56a..848b137151c26 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -541,13 +541,20 @@ static bool tcp_in_window(const struct nf_conn *ct,
 			swin = win << sender->td_scale;
 			sender->td_maxwin = (swin == 0 ? 1 : swin);
 			sender->td_maxend = end + sender->td_maxwin;
-			/*
-			 * We haven't seen traffic in the other direction yet
-			 * but we have to tweak window tracking to pass III
-			 * and IV until that happens.
-			 */
-			if (receiver->td_maxwin == 0)
+			if (receiver->td_maxwin == 0) {
+				/* We haven't seen traffic in the other
+				 * direction yet but we have to tweak window
+				 * tracking to pass III and IV until that
+				 * happens.
+				 */
 				receiver->td_end = receiver->td_maxend = sack;
+			} else if (sack == receiver->td_end + 1) {
+				/* Likely a reply to a keepalive.
+				 * Needed for III.
+				 */
+				receiver->td_end++;
+			}
+
 		}
 	} else if (((state->state == TCP_CONNTRACK_SYN_SENT
 		     && dir == IP_CT_DIR_ORIGINAL)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux