From patchwork Fri May 10 12:24:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Xing X-Patchwork-Id: 13661539 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-il1-f178.google.com (mail-il1-f178.google.com [209.85.166.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A9374F1E5 for ; Fri, 10 May 2024 12:25:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715343914; cv=none; b=pkBffG4ziP9nbZ+wl8Cbrdqs8E3zmAQ5/6L8WV2Q+jEzsXHOOzmJm1dvaNQtsNpyZJkkuFyWOUfYzWSBVcv8aKDWhOVxw0Rg6Xb7nmLfGw6y/dK1amTYwwydpxW3gL5dDb389ZElwQ6s0eINPFAId4YWSF5jEEXt3RIdslxR/k0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715343914; c=relaxed/simple; bh=OrfoT4YOwRlve6mV0AW69N1v9S7JlhMBl+7xYefdoZ4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=riKNffi4xUdk5+xgYaQrDkB6GRzKCczjYgKTCzfX0iawuvl0Ahu/18Irne4FP5F8PcvNQrXPLZ4wP9sx7IhvXzSGLVfOscFY8HByZcP3sMLgQSIgcbCywaRha5mt3nMzpLK38pYiqGmuziWfzYwcf4iCa/2H9zXJd12wK3Jwf54= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QwvZMhfL; arc=none smtp.client-ip=209.85.166.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QwvZMhfL" Received: by mail-il1-f178.google.com with SMTP id e9e14a558f8ab-36c6e69180fso7058995ab.3 for ; Fri, 10 May 2024 05:25:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715343912; x=1715948712; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Dq4Oif0buUnA9JqMotGU1jFbPA8b2GKc51i6wlfOjfg=; b=QwvZMhfLeMFpxIMsw2CyerntJUzNbmiHx+MszMZgyD2zNwU7QEHRgoltzzVdEiFjkF ArWKGp5qx/A5NwgNYA2Qsik2cdSaubrL29mQlM9SOVL34a8DAk7rjyPjYftWJv04UqKE dwZsybR2wzHyIfP0pu74AWJnO4Cv4XVFSs6Iq+iF5GhFLGLrheb+a2iI1UY//+5LFEMn BA5XTap3YCKdoLFWcMIQkUzpLUU7xYpY4fO5GbMccI8HOFBc0KU4wUrBLe6d/cfqzzN6 Uqc1vkMQxNFiwetZM+97tXKvOoSqYoC6uKpKA0iI2tUHZaii91vfQK5Bygv+yeFzyOnm jpZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715343912; x=1715948712; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Dq4Oif0buUnA9JqMotGU1jFbPA8b2GKc51i6wlfOjfg=; b=jsRuFBImw1ObOSDfrURoSwzI2ALGAqlgiXCbh8kWQ1WUmdRHgjlNETo2F38DBcDehA v+Ww+mRtk2LNVLjVE5CTRQJD/4O4C2Z3OC00mhQgB85iHvHNEK4dElriq2U3DUQv+jp4 pucZwWOMQH7oIAghAC7HOVc3vq6yRTwKHJMKGFGq7lOg3z00IY7g2E6UEV9XfAUNZcxa Zs4Zg2k6sG1tcwFp4y8C0QkpC60MeM5A14fvkWCQVwxXXGWUyH1Zbl4f5NdM85EN/yY7 +7LEfgyb6pyajTuqL9G3zQw3iPAqV6PuJtndd1iF+njfFEjnASVaL+ffArip08G7omRv o8cQ== X-Gm-Message-State: AOJu0YykNhEL+GN7kOtgYEsdENye0/Qv0cwwt+g/fi/fNMlyc0nOwmAe BLW2BdijQ8Vgc1u6t+3WpYV5hjDAB+7IUxxNfrQuGrUN1Thg+7Me X-Google-Smtp-Source: AGHT+IF20w0wZzrB+orUxdMVjA8fPvyGn6djtVPMoKXJaJshCcwSWDQFeBzbXyeQuGcTwcp0DV/xig== X-Received: by 2002:a92:c54b:0:b0:36c:7bdb:c86b with SMTP id e9e14a558f8ab-36cc143a021mr28596025ab.9.1715343911970; Fri, 10 May 2024 05:25:11 -0700 (PDT) Received: from KERNELXING-MB0.tencent.com ([43.132.141.25]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-6340b57f362sm2943530a12.30.2024.05.10.05.25.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 05:25:11 -0700 (PDT) From: Jason Xing To: edumazet@google.com, dsahern@kernel.org, kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net Cc: netdev@vger.kernel.org, kerneljasonxing@gmail.com, Jason Xing Subject: [PATCH net-next v2 1/5] tcp: rstreason: fully support in tcp_rcv_synsent_state_process() Date: Fri, 10 May 2024 20:24:58 +0800 Message-Id: <20240510122502.27850-2-kerneljasonxing@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240510122502.27850-1-kerneljasonxing@gmail.com> References: <20240510122502.27850-1-kerneljasonxing@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Jason Xing In this function, only updating the map can finish the job for socket reset reason because the corresponding drop reasons are ready. Signed-off-by: Jason Xing --- include/net/rstreason.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/net/rstreason.h b/include/net/rstreason.h index df3b6ac0c9b3..f87814a60205 100644 --- a/include/net/rstreason.h +++ b/include/net/rstreason.h @@ -8,6 +8,8 @@ #define DEFINE_RST_REASON(FN, FNe) \ FN(NOT_SPECIFIED) \ FN(NO_SOCKET) \ + FN(TCP_INVALID_ACK_SEQUENCE) \ + FN(TCP_RFC7323_PAWS) \ FN(MPTCP_RST_EUNSPEC) \ FN(MPTCP_RST_EMPTCP) \ FN(MPTCP_RST_ERESOURCE) \ @@ -37,6 +39,17 @@ enum sk_rst_reason { SK_RST_REASON_NOT_SPECIFIED, /** @SK_RST_REASON_NO_SOCKET: no valid socket that can be used */ SK_RST_REASON_NO_SOCKET, + /** + * @SK_RST_REASON_TCP_INVALID_ACK_SEQUENCE: Not acceptable ACK SEQ + * field because ack sequence is not in the window between snd_una + * and snd_nxt + */ + SK_RST_REASON_TCP_INVALID_ACK_SEQUENCE, + /** + * @SK_RST_REASON_TCP_RFC7323_PAWS: PAWS check, corresponding to + * LINUX_MIB_PAWSESTABREJECTED, LINUX_MIB_PAWSACTIVEREJECTED + */ + SK_RST_REASON_TCP_RFC7323_PAWS, /* Copy from include/uapi/linux/mptcp.h. * These reset fields will not be changed since they adhere to @@ -113,6 +126,10 @@ sk_rst_convert_drop_reason(enum skb_drop_reason reason) return SK_RST_REASON_NOT_SPECIFIED; case SKB_DROP_REASON_NO_SOCKET: return SK_RST_REASON_NO_SOCKET; + case SKB_DROP_REASON_TCP_INVALID_ACK_SEQUENCE: + return SK_RST_REASON_TCP_INVALID_ACK_SEQUENCE; + case SKB_DROP_REASON_TCP_RFC7323_PAWS: + return SK_RST_REASON_TCP_RFC7323_PAWS; default: /* If we don't have our own corresponding reason */ return SK_RST_REASON_NOT_SPECIFIED; From patchwork Fri May 10 12:24:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Xing X-Patchwork-Id: 13661540 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-il1-f171.google.com (mail-il1-f171.google.com [209.85.166.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5C3B15491 for ; Fri, 10 May 2024 12:25:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715343917; cv=none; b=mAq8edRoZyHWPQBXsWnsEY5m93wdl9O3RE4NQkjSbyOISfVAaP5P520qhmI3kXxQ/F7mQTpZjt8xRBtWZdnU5VWKqpscVDl/BTSjl4vg9IxQv9TDW3uuMZmLcAIv7/Okc3o9zJqmIVRVgZj1Fq3NNV8z94GD1jYKU0RoEvB2HbM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715343917; c=relaxed/simple; bh=eFIuyMNsLA6X4/v7gxs8rGdBPEoWfAe1S56NltpROuM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KBfq7WBxkfMJvTpNIBVbPckb0rn68pGPfE9K/LtjuH2Fy/18KPlbL1JFLod2Tl6xWtV7UVZWAV2mDRrHuq+KNG1xReO8coXW84E5OFoDfrkjB6R8zX43r+9ZzFYxv8ZRut/uoa3A8wcZMyM2ps/WUHkyK6NadxGhd/iRJyis1+w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gIUxkZBI; arc=none smtp.client-ip=209.85.166.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gIUxkZBI" Received: by mail-il1-f171.google.com with SMTP id e9e14a558f8ab-36c7ee71ebaso8410955ab.2 for ; Fri, 10 May 2024 05:25:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715343915; x=1715948715; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uyB/KgVUIo82Ok1tiI/arZVWzblSnbVI0Sc+QvPXRmE=; b=gIUxkZBI7Ws8y8BFrhh/sYXidd3PPIf9XhVYCphApxivo+CNWfKLFqyBwruMd4m860 68a8kLCh8pFbrI/mckJBa94NGdOxNcS9VTfnHfmCPY4GUoyBl3pBCNRT96nrkMT2AVtn JAMBUqpe8iXe7AMWRNP73dOj1xlX9Y9U+qAR/gUoisdcFSz0prDuFa8oL6lj7SLakNgL 7oSBXzOfGr6ytKfxQwA9JK8WVAR0q/4RzfjBdF8b9/OqtUmanOxWEA3yXdD/PBCmd9CV W4CYn2Ov+bfh+EcCxaduHR1NUM/CMKwHvSFbn40iU/0jKH8Wd4GL6uW8yPoXKoSTyYKv T9xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715343915; x=1715948715; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uyB/KgVUIo82Ok1tiI/arZVWzblSnbVI0Sc+QvPXRmE=; b=Nq8NsQHkXrVsXiO32cT6T3X0Xgdf/Z9oOYWee2rNetBJ4xo+ANl2NDd0zJznOM+5W/ av6V4ZABOgK7eBj8JuB0r6rqiXmk5Tj3Fbjsv8iRYJAJb+E+BvxhXs1RUHy8ZsvBMsbn 4TjM4/FRcyWPmSMbtAr5T3Reiom61W2S4jRizaKbB0rs/2SnwX4pbBP74pSqZJqxvUpX p/sVcBheewZZxZbWZmdPgtF90m1YRrvdevBS7haMFZSFq2VE/5vEiHJrxEoaAMG2Cmsw p+Ddc5OSJ2XYiMe4qPzfF2/TWdTY256aKoMrLZ5RFr6sOZ6yMApHB5j8EX5eD4A//QD7 aTXA== X-Gm-Message-State: AOJu0YzqCWZyzMscb6k1HjDZmgVpJzfJlwuwnkew3yz2pPVMUzrq/Nzj dtd32Ce/RAU1By1xBg8TsSSQosdHM/vR4BSG8qnetRgDwtA74EF4 X-Google-Smtp-Source: AGHT+IGoqVWTpDjcFGBWrJ2aj4db58ldT/33H8t3QUVLkLBNZYH4K+Jhiamtaa5eelZpHw6ZosP4/A== X-Received: by 2002:a05:6e02:1a0a:b0:36c:5143:73d6 with SMTP id e9e14a558f8ab-36cc14aa150mr29798275ab.16.1715343914823; Fri, 10 May 2024 05:25:14 -0700 (PDT) Received: from KERNELXING-MB0.tencent.com ([43.132.141.25]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-6340b57f362sm2943530a12.30.2024.05.10.05.25.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 05:25:14 -0700 (PDT) From: Jason Xing To: edumazet@google.com, dsahern@kernel.org, kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net Cc: netdev@vger.kernel.org, kerneljasonxing@gmail.com, Jason Xing Subject: [PATCH net-next v2 2/5] tcp: rstreason: fully support in tcp_ack() Date: Fri, 10 May 2024 20:24:59 +0800 Message-Id: <20240510122502.27850-3-kerneljasonxing@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240510122502.27850-1-kerneljasonxing@gmail.com> References: <20240510122502.27850-1-kerneljasonxing@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Jason Xing Based on the existing skb drop reason, updating the rstreason map can help us finish the rstreason job in this function. Signed-off-by: Jason Xing --- include/net/rstreason.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/net/rstreason.h b/include/net/rstreason.h index f87814a60205..69404c14f45d 100644 --- a/include/net/rstreason.h +++ b/include/net/rstreason.h @@ -10,6 +10,8 @@ FN(NO_SOCKET) \ FN(TCP_INVALID_ACK_SEQUENCE) \ FN(TCP_RFC7323_PAWS) \ + FN(TCP_TOO_OLD_ACK) \ + FN(TCP_ACK_UNSENT_DATA) \ FN(MPTCP_RST_EUNSPEC) \ FN(MPTCP_RST_EMPTCP) \ FN(MPTCP_RST_ERESOURCE) \ @@ -50,6 +52,13 @@ enum sk_rst_reason { * LINUX_MIB_PAWSESTABREJECTED, LINUX_MIB_PAWSACTIVEREJECTED */ SK_RST_REASON_TCP_RFC7323_PAWS, + /** @SK_RST_REASON_TCP_TOO_OLD_ACK: TCP ACK is too old */ + SK_RST_REASON_TCP_TOO_OLD_ACK, + /** + * @SK_RST_REASON_TCP_ACK_UNSENT_DATA: TCP ACK for data we haven't + * sent yet + */ + SK_RST_REASON_TCP_ACK_UNSENT_DATA, /* Copy from include/uapi/linux/mptcp.h. * These reset fields will not be changed since they adhere to @@ -130,6 +139,10 @@ sk_rst_convert_drop_reason(enum skb_drop_reason reason) return SK_RST_REASON_TCP_INVALID_ACK_SEQUENCE; case SKB_DROP_REASON_TCP_RFC7323_PAWS: return SK_RST_REASON_TCP_RFC7323_PAWS; + case SKB_DROP_REASON_TCP_TOO_OLD_ACK: + return SK_RST_REASON_TCP_TOO_OLD_ACK; + case SKB_DROP_REASON_TCP_ACK_UNSENT_DATA: + return SK_RST_REASON_TCP_ACK_UNSENT_DATA; default: /* If we don't have our own corresponding reason */ return SK_RST_REASON_NOT_SPECIFIED; From patchwork Fri May 10 12:25:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Xing X-Patchwork-Id: 13661541 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8666B15B130 for ; Fri, 10 May 2024 12:25:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715343920; cv=none; b=hUVPXdHyy6M6iEGA+GkgH70f+Tujm69icf81f9TmSvBzssMHxWruVZ6PXgpyE8KnLmtf0a7in/aotNi0RBcjj+sBcRccURKU4xMRkceK8isvB4MdKk01SYRRg0p3uXoN9W6nvFC756StVhxEZB+Es6fZLmuEgxZirVHamp9UDcc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715343920; c=relaxed/simple; bh=/3wi7wJKWOBh7YdMKZ5L8V53sk1POv1ZXjrpRbSLbkA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BaChAHwHdfs06hKZU2t5qODRQN2Bsh9XnKOqhWho7yA3H5XvlDpIb+0oQnETwxQFYyoDMqBNze3D8Kid8jNCN+gfbouDBg+XCZKRsJxdxEcjYbuDijJTn+Wp6nINHQFeFySMHz/EgaxnezJ8A1L58bkOb0+hPqG9Ap/t/YSxRPw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=c2qdLHAt; arc=none smtp.client-ip=209.85.161.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="c2qdLHAt" Received: by mail-oo1-f54.google.com with SMTP id 006d021491bc7-5af03aa8814so1163219eaf.2 for ; Fri, 10 May 2024 05:25:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715343917; x=1715948717; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JHpMFJ1UwPPt0NNwuNMaPd7lXkDR4LuxEDt7QyfdwyI=; b=c2qdLHAtgqpaoIF36po4T3QgD+Vm3AlE9rExnzR99ghUHNTHRgrvcBmNbyGmwwxbcL J74AHUdsmJOqDmddrK2V37cg5MHeWEPtwC5mEiT0cwDwZblBvWJK+nUxRJJ+VbYa6H9w Uo9qq1KmKUQAiQNozZ1hHp9SsYDNoKRRUe9hnuzidqKlYqqRQhq6Z9LbiaBCBJg/uD8/ WXCzDnbCrwhwczasHGvNUoLtABX4Jc+aNyd1aOXcLnFBG4FkbXApme1zQqJzPSY6ID6D QlT/+KWa3utJbyCRFiMQbs59ODfZvrcPN9ufpoYNQUf8r77yM7XE+chS3yAI/8/UH3cj 4fEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715343917; x=1715948717; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JHpMFJ1UwPPt0NNwuNMaPd7lXkDR4LuxEDt7QyfdwyI=; b=EgG6G7huqj0pwxggr8zpWb0OM2K7jMkYCMCNavOdGCBt1mc85BIIMaPxrMiPIeXd3q J1xFrV+FUu2T9H5rx0mqil83khkurniKwAyh5u+GEf/hVdnTVjj0k0wEzdv75Kxa0XxY RupJkHsyrGyEzWi3oabw81qoU93dv9d9ivaDexH8KYi2bKKlvrsL9LJKITvQbUOWdjIl mXwwrh7Txq0syS2lsPRshY56d7wxSGv4l3glz14wDRWcfknnXey5kniLNefilJyZSkfz 71UN/fcNo9Iqj+0G7R6EQZq0z5PC+7Rli9Gec57Ax8UUd/Hi//IPaOhCqncjvCnoNl5i GHcQ== X-Gm-Message-State: AOJu0YypfF8XeTQkCqifKVcEJP2OcCcAJ4MfsEAABJo0GdYMAOuZlpv9 kU4TbKlGf1ObT2Hohhbp9HLKkfiV4F71sMYYOl8ERB/0UH2BBWus X-Google-Smtp-Source: AGHT+IF7MMzRa0kNodl31ybwDPceV03b+aYoWpTUCldLQAMYy5+dJ5Zv7PfzZ3T2CVqWFctcWsn+BA== X-Received: by 2002:a05:6358:8093:b0:192:5510:e3ee with SMTP id e5c5f4694b2df-193bb623eb1mr278302155d.13.1715343917510; Fri, 10 May 2024 05:25:17 -0700 (PDT) Received: from KERNELXING-MB0.tencent.com ([43.132.141.25]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-6340b57f362sm2943530a12.30.2024.05.10.05.25.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 05:25:17 -0700 (PDT) From: Jason Xing To: edumazet@google.com, dsahern@kernel.org, kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net Cc: netdev@vger.kernel.org, kerneljasonxing@gmail.com, Jason Xing Subject: [PATCH net-next v2 3/5] tcp: rstreason: fully support in tcp_rcv_state_process() Date: Fri, 10 May 2024 20:25:00 +0800 Message-Id: <20240510122502.27850-4-kerneljasonxing@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240510122502.27850-1-kerneljasonxing@gmail.com> References: <20240510122502.27850-1-kerneljasonxing@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Jason Xing Like the previous patch does in this series, finish the conversion map is enough to let rstreason mechanism work in this function. Signed-off-by: Jason Xing --- include/net/rstreason.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/net/rstreason.h b/include/net/rstreason.h index 69404c14f45d..fc1b99702771 100644 --- a/include/net/rstreason.h +++ b/include/net/rstreason.h @@ -12,6 +12,9 @@ FN(TCP_RFC7323_PAWS) \ FN(TCP_TOO_OLD_ACK) \ FN(TCP_ACK_UNSENT_DATA) \ + FN(TCP_FLAGS) \ + FN(TCP_OLD_ACK) \ + FN(TCP_ABORT_ON_DATA) \ FN(MPTCP_RST_EUNSPEC) \ FN(MPTCP_RST_EMPTCP) \ FN(MPTCP_RST_ERESOURCE) \ @@ -59,6 +62,15 @@ enum sk_rst_reason { * sent yet */ SK_RST_REASON_TCP_ACK_UNSENT_DATA, + /** @SK_RST_REASON_TCP_FLAGS: TCP flags invalid */ + SK_RST_REASON_TCP_FLAGS, + /** @SK_RST_REASON_TCP_OLD_ACK: TCP ACK is old, but in window */ + SK_RST_REASON_TCP_OLD_ACK, + /** + * @SK_RST_REASON_TCP_ABORT_ON_DATA: abort on data + * corresponding to LINUX_MIB_TCPABORTONDATA + */ + SK_RST_REASON_TCP_ABORT_ON_DATA, /* Copy from include/uapi/linux/mptcp.h. * These reset fields will not be changed since they adhere to @@ -143,6 +155,12 @@ sk_rst_convert_drop_reason(enum skb_drop_reason reason) return SK_RST_REASON_TCP_TOO_OLD_ACK; case SKB_DROP_REASON_TCP_ACK_UNSENT_DATA: return SK_RST_REASON_TCP_ACK_UNSENT_DATA; + case SKB_DROP_REASON_TCP_FLAGS: + return SK_RST_REASON_TCP_FLAGS; + case SKB_DROP_REASON_TCP_OLD_ACK: + return SK_RST_REASON_TCP_OLD_ACK; + case SKB_DROP_REASON_TCP_ABORT_ON_DATA: + return SK_RST_REASON_TCP_ABORT_ON_DATA; default: /* If we don't have our own corresponding reason */ return SK_RST_REASON_NOT_SPECIFIED; From patchwork Fri May 10 12:25:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Xing X-Patchwork-Id: 13661542 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53F1116DED7 for ; Fri, 10 May 2024 12:25:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715343922; cv=none; b=V6q0zdYqwQVw7lY/fLepZd1y1tT66Ii0yKrzaIDMXqhLdMU3yoljvnJMd0K8IvDF8mlPVOdWafc0aDeHt+xJFUQ+ChXUxOrN435ZCfn49KHRxZAHNYueznIuf02EjgWlVHqv4g9tNTTtY6AJVWyxA35CuEJs1LZRrf5wnShrsvE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715343922; c=relaxed/simple; bh=QhLHsr4q9mx8ubOT3pnejzEK0cBC1QdoRCtcOCZIiko=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bbncDdcCf+2CyhjgtmKMdjUdsW5kT5o27ZIhOZ7F6AUYiXtHHy6q4E8odKKLYDZZl+cffRm/xD7MpDaLSSolaYmFm5cesBXulpkUvNCOQg3AHgak+/xx8IA1VZ3Ma14oMZMutq/4vYVZI//FQXJIiVtsWhgL/gk5e/B9s8u2wFM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=apGSHgm5; arc=none smtp.client-ip=209.85.161.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="apGSHgm5" Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-5b273b9f1deso890878eaf.3 for ; Fri, 10 May 2024 05:25:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715343920; x=1715948720; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=q4C5pHde1tDmuDAUEtokuBbtsfGpTSJVnMuEbxlFEPk=; b=apGSHgm50rAFn2h4mStDOozZPsB4PcXlx9GMWvMfVZvMR9PIyXiVXxYGYt7scK56iK dZNm+nIwbWBdVHhNfL3tyrilIaYSmAuPaEbZPSxFges78TE0AXFLHeZa+F/a1VmkK22e zZOUHaTJATW0457YNC25CbwVkJYqxMrxRBmxA2oWl0br4/2Ht8a8X9c0bEfLYTseSNA+ jrCCzsUgoxRARMX8M3hm37PqOJjX3I63vRHGqi7yOMv2D1T3ikb3tINJXCQZhQcspV/W wT8Bvjcyyvbbt1WiA688CUp3h8U6sbGakTuoaZBnc2Az/jb6nBHz5h3FqcGw7YIz9Cd7 u/4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715343920; x=1715948720; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q4C5pHde1tDmuDAUEtokuBbtsfGpTSJVnMuEbxlFEPk=; b=fYAPsTCFOFDcaPCNGCirxGhKNymrK2aDgsZQbsOLu76Ejvs5F2cfuA1Z7nxFA50/Da I416CzXDg1uwVD6IOuy0KWb7hGc+ytE6sHd3RHl2LzyGlOTA4fCMx1I7Q2lJcPcHnsfL wfBSXEKSTnOC2YAmzSJks9qS1oKJgSRSauSOCV0WSGzQp1ISqpCNheZ3KeUxEdp5trtO 98ZvOthDiW6x6s4Is5W9pdHPyamYdoqFqlxLheoHm5EHI2VfpHVsY1DTmyZfYuz1NUbk TN2C8+XzICYhS8S2SHlmyq01l3aoAKZgEJXtIBZzGBqPz9hRfhLObtt8oaV7/O2PPNRp Lr/g== X-Gm-Message-State: AOJu0YxKtizn+LmzXjyQzRnxODK4oaiR56MXByz9EVCGsDslsAheKz5m n23R/6uVdKowQ1VPYEjVfWQ1zmMnQ59+urMYtcTncgHzz4oWgqxX X-Google-Smtp-Source: AGHT+IERpy4GujC1MROXjzfTjpMogp2cAILDXypCbn5APb+w3uqVqS1+13DK7LNjMQyFbkIb54e+2g== X-Received: by 2002:a05:6358:5694:b0:18d:8c13:b83d with SMTP id e5c5f4694b2df-193baeda1f1mr270393155d.0.1715343920226; Fri, 10 May 2024 05:25:20 -0700 (PDT) Received: from KERNELXING-MB0.tencent.com ([43.132.141.25]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-6340b57f362sm2943530a12.30.2024.05.10.05.25.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 05:25:19 -0700 (PDT) From: Jason Xing To: edumazet@google.com, dsahern@kernel.org, kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net Cc: netdev@vger.kernel.org, kerneljasonxing@gmail.com, Jason Xing Subject: [PATCH net-next v2 4/5] tcp: rstreason: handle timewait cases in the receive path Date: Fri, 10 May 2024 20:25:01 +0800 Message-Id: <20240510122502.27850-5-kerneljasonxing@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240510122502.27850-1-kerneljasonxing@gmail.com> References: <20240510122502.27850-1-kerneljasonxing@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Jason Xing There are two possible cases where TCP layer can send an RST. Since they happen in the same place, I think using one independent reason is enough to identify this special situation. Signed-off-by: Jason Xing --- include/net/rstreason.h | 5 +++++ net/ipv4/tcp_ipv4.c | 2 +- net/ipv6/tcp_ipv6.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/net/rstreason.h b/include/net/rstreason.h index fc1b99702771..7ae5bb55559b 100644 --- a/include/net/rstreason.h +++ b/include/net/rstreason.h @@ -15,6 +15,7 @@ FN(TCP_FLAGS) \ FN(TCP_OLD_ACK) \ FN(TCP_ABORT_ON_DATA) \ + FN(TCP_TIMEWAIT_SOCKET) \ FN(MPTCP_RST_EUNSPEC) \ FN(MPTCP_RST_EMPTCP) \ FN(MPTCP_RST_ERESOURCE) \ @@ -72,6 +73,10 @@ enum sk_rst_reason { */ SK_RST_REASON_TCP_ABORT_ON_DATA, + /* Here start with the independent reasons */ + /** @SK_RST_REASON_TCP_TIMEWAIT_SOCKET: happen on the timewait socket */ + SK_RST_REASON_TCP_TIMEWAIT_SOCKET, + /* Copy from include/uapi/linux/mptcp.h. * These reset fields will not be changed since they adhere to * RFC 8684. So do not touch them. I'm going to list each definition diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 108a438dc247..30ef0c8f5e92 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -2427,7 +2427,7 @@ int tcp_v4_rcv(struct sk_buff *skb) tcp_v4_timewait_ack(sk, skb); break; case TCP_TW_RST: - tcp_v4_send_reset(sk, skb, sk_rst_convert_drop_reason(drop_reason)); + tcp_v4_send_reset(sk, skb, SK_RST_REASON_TCP_TIMEWAIT_SOCKET); inet_twsk_deschedule_put(inet_twsk(sk)); goto discard_it; case TCP_TW_SUCCESS:; diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 7f6693e794bd..4c3605485b68 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -1999,7 +1999,7 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb) tcp_v6_timewait_ack(sk, skb); break; case TCP_TW_RST: - tcp_v6_send_reset(sk, skb, sk_rst_convert_drop_reason(drop_reason)); + tcp_v6_send_reset(sk, skb, SK_RST_REASON_TCP_TIMEWAIT_SOCKET); inet_twsk_deschedule_put(inet_twsk(sk)); goto discard_it; case TCP_TW_SUCCESS: From patchwork Fri May 10 12:25:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Xing X-Patchwork-Id: 13661543 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA4F516D4F4 for ; Fri, 10 May 2024 12:25:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715343925; cv=none; b=d87KshJVyDtBVliRfVQLqvOuiTSOLyyDjSv/CBtiy8/O5tbyYbMxmpYl+pR07a4T/FUeZa+zoZnOJASzHzfadNEXpoTgj1z7yk1/YDIP295RBS+KW/NVwgkHQfZlcOUpYZX5yJlwXT0RHK2K3D8RyDTuIH5WAaIwy+bGWr9WYL4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715343925; c=relaxed/simple; bh=dOPWA5oUMFLJMkyrjOLwiNM4jqXOocS06R2V1tpKFlo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UOhh8SCbxWVIWPDo8gSSamx2RK6CR4DcIvHAd4WYxk3ups5SN3bcdUmamTNIHmGVUZZ8dwOKBKyS6PbYPbhMYSWuvsRPTYLWag58capboLrx5EY2S4f+LEk94IWgTicRHzEQ2S2GHRYxjbHOz1aEJtFo2fvuC1EWBOMqUbjEAyI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XTwmRuBu; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XTwmRuBu" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-6f449ea8e37so1671044b3a.3 for ; Fri, 10 May 2024 05:25:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715343923; x=1715948723; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UlCmy+iZAQgDelBlhi5+PpnGFmqq4Df4VsGrbrOxgsM=; b=XTwmRuBuSHjYjk1Cczq03RjEyWWuRO1tCmYxaBJ7z4D2B6NMHRKLqZNVk9JV5kC+Tw tF+LWOxgqUcYoVyO0IBYty3ujpCF/D7vZvi+z+tXUlowkZnlM2/BydA/n1wReVCejHyB 0+dKkjbitAkJrPobOUSkw2JyxbKEk+tccHmT7m0/6///8tuIuqWdvLDSQ8OtfJptW8nE iR0s/K/PYQ+Hn+SIW8Q8JxTAO5/QntwP7/HNYeqJZCv7c0XoO2o3nAZGk4dlBkxL07Zx bJK/e64iYzcu3Z/rBpHbnqOYChADNU9k3Sakx97++QLBUjtRc2uRqR1tvZMyoqyf8StL SKfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715343923; x=1715948723; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UlCmy+iZAQgDelBlhi5+PpnGFmqq4Df4VsGrbrOxgsM=; b=FggrKHuZ7O70R5OGUtSA4bNtQjvxSaJdDsb4iuTfYhQC4Xny1XvnFBIPumauB2/o8L rZLxXDekm5IiMN8loDzjc6QObzh3gasRA5/JYq1BSYHKra0Nq/zR4bwEXf2Orp0VR4pq tO4blBrXRklHzkh7lTWb9I/RGJOek2bApUDQ8xQMjmznFJKJ7xM4qDPBb4o4zwpWRSQD YoEJimIzRzOQOzkHGpGZgCvJCQ0ZY5qHVaMOVjoE2tkIzCVZAB63ajNxeVLtLXMLyath MXHvyOUEkMCsEzxrtfO9YshzhSAOnru89X5As6U/CxGwJwl6a1EFLe8Fp91w1y4D8JQ6 4zZA== X-Gm-Message-State: AOJu0YzAd40DAUBIVhzAnzkmSgx+gl6GAgvYr/NcDptYf1iRmcEU6tpp UoHqXgm5sBDR8tVuhPW8gX5y5wsebkUHrcsC7KHl2qvPbCcI3rVY X-Google-Smtp-Source: AGHT+IHa1IEfofgHSTXuWQF1qnE6SdHpidxY8sgIYZD8gh/Ipx0le+uaNxiPvtGwUu3qOXD+zuaWdw== X-Received: by 2002:a05:6a00:391a:b0:6f3:876a:c029 with SMTP id d2e1a72fcca58-6f4e02ac99bmr2752898b3a.10.1715343922979; Fri, 10 May 2024 05:25:22 -0700 (PDT) Received: from KERNELXING-MB0.tencent.com ([43.132.141.25]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-6340b57f362sm2943530a12.30.2024.05.10.05.25.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 05:25:22 -0700 (PDT) From: Jason Xing To: edumazet@google.com, dsahern@kernel.org, kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net Cc: netdev@vger.kernel.org, kerneljasonxing@gmail.com, Jason Xing Subject: [PATCH net-next v2 5/5] tcp: rstreason: fully support in tcp_check_req() Date: Fri, 10 May 2024 20:25:02 +0800 Message-Id: <20240510122502.27850-6-kerneljasonxing@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240510122502.27850-1-kerneljasonxing@gmail.com> References: <20240510122502.27850-1-kerneljasonxing@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Jason Xing We're going to send an RST due to invalid syn packet which is already checked whether 1) it is in sequence, 2) it is a retransmitted skb. As RFC 793 says, if the state of socket is not CLOSED/LISTEN/SYN-SENT, then we should send an RST when receiving bad syn packet: "fourth, check the SYN bit,...If the SYN is in the window it is an error, send a reset" Signed-off-by: Jason Xing --- include/net/rstreason.h | 8 ++++++++ net/ipv4/tcp_minisocks.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/net/rstreason.h b/include/net/rstreason.h index 7ae5bb55559b..2575c85d7f7a 100644 --- a/include/net/rstreason.h +++ b/include/net/rstreason.h @@ -16,6 +16,7 @@ FN(TCP_OLD_ACK) \ FN(TCP_ABORT_ON_DATA) \ FN(TCP_TIMEWAIT_SOCKET) \ + FN(INVALID_SYN) \ FN(MPTCP_RST_EUNSPEC) \ FN(MPTCP_RST_EMPTCP) \ FN(MPTCP_RST_ERESOURCE) \ @@ -76,6 +77,13 @@ enum sk_rst_reason { /* Here start with the independent reasons */ /** @SK_RST_REASON_TCP_TIMEWAIT_SOCKET: happen on the timewait socket */ SK_RST_REASON_TCP_TIMEWAIT_SOCKET, + /** + * @SK_RST_REASON_INVALID_SYN: receive bad syn packet + * RFC 793 says if the state is not CLOSED/LISTEN/SYN-SENT then + * "fourth, check the SYN bit,...If the SYN is in the window it is + * an error, send a reset" + */ + SK_RST_REASON_INVALID_SYN, /* Copy from include/uapi/linux/mptcp.h. * These reset fields will not be changed since they adhere to diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 7d543569a180..b93619b2384b 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c @@ -879,7 +879,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb, * avoid becoming vulnerable to outside attack aiming at * resetting legit local connections. */ - req->rsk_ops->send_reset(sk, skb, SK_RST_REASON_NOT_SPECIFIED); + req->rsk_ops->send_reset(sk, skb, SK_RST_REASON_INVALID_SYN); } else if (fastopen) { /* received a valid RST pkt */ reqsk_fastopen_remove(sk, req, true); tcp_reset(sk, skb);