Skip to content

Commit 0477d97

Browse files
author
Herton R. Krzesinski
committed
Merge: netfilter: conntrack: handle tcp challenge acks during connection reuse
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/2000 Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2159642 Upstream Status: commit c410cb9 Tested: customer, via packetdrill and scapy reproducers Signed-off-by: Florian Westphal <fwestpha@redhat.com> Approved-by: Antoine Tenart <atenart@redhat.com> Approved-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2 parents 98b61c5 + 6d5e9e7 commit 0477d97

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

net/netfilter/nf_conntrack_proto_tcp.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,13 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct,
10681068
ct->proto.tcp.last_flags |=
10691069
IP_CT_EXP_CHALLENGE_ACK;
10701070
}
1071+
1072+
/* possible challenge ack reply to syn */
1073+
if (old_state == TCP_CONNTRACK_SYN_SENT &&
1074+
index == TCP_ACK_SET &&
1075+
dir == IP_CT_DIR_REPLY)
1076+
ct->proto.tcp.last_ack = ntohl(th->ack_seq);
1077+
10711078
spin_unlock_bh(&ct->lock);
10721079
nf_ct_l4proto_log_invalid(skb, ct, state,
10731080
"packet (index %d) in dir %d ignored, state %s",
@@ -1193,6 +1200,14 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct,
11931200
* segments we ignored. */
11941201
goto in_window;
11951202
}
1203+
1204+
/* Reset in response to a challenge-ack we let through earlier */
1205+
if (old_state == TCP_CONNTRACK_SYN_SENT &&
1206+
ct->proto.tcp.last_index == TCP_ACK_SET &&
1207+
ct->proto.tcp.last_dir == IP_CT_DIR_REPLY &&
1208+
ntohl(th->seq) == ct->proto.tcp.last_ack)
1209+
goto in_window;
1210+
11961211
break;
11971212
default:
11981213
/* Keep compilers happy. */

0 commit comments

Comments
 (0)