From patchwork Sun Oct 6 20:32:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13823853 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (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 9C878158862 for ; Sun, 6 Oct 2024 20:32:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728246752; cv=none; b=FwcGDY1wza7KojzSgQy3hhypVORZnrHelbeLQI9YR6wPe5/nxuD1bhlWuu5eAmVBRxDMVc0oUD4u2oP741YjzYfJQ6YnwsEWrMUtrvzPliaUBEEFuHoQzNtePBl3XQtY4pjL4wGbeDm5a6RiKhyAE2q1/oT7dORS69d/NVMv6EQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728246752; c=relaxed/simple; bh=yjClOwoGKCxCs7CExlSyEn9dlneuePw6WTmxaNZ323I=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=lYwzlgRjzEZf7LA/PbmbF603N8zvW1zPBJDknHeU+4BndQVDfYI0JpLXiUvDYH6ECImz85mhYTihuaArmNkABsTvcoRT9xi0BtKH9Ag5nWTD+4+e2G5CvT11FTNiAX4o/riqonoTpD/F+xFyJ1kN+0G+RACMlymtEYMfYJt5QUQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Bz0IT2Eg; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Bz0IT2Eg" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e2d1860a62so29412637b3.0 for ; Sun, 06 Oct 2024 13:32:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728246749; x=1728851549; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=PZ6/WewJdBdhfP6ZBSehm4FgOeIcxqqUY3isW9WVj+g=; b=Bz0IT2Egxsl+doaiCXPHG/z6oRITAL3qBTLUlm3sWy0Ts0+lEB+6HC8WztHyLX6X+s GwI9+GZIxZzEbFGwz9WhLAA3/gbXVTyFUdWF7gRpDDGaLEf2o9wg1QHll6Oc90w17K5G j2Tkcx11VA93Yh6eZQJMiCcOAwL2/8B2LP4HRx8lWDOlyIgML5wmnHdT5a9ESeLuVYWo NP6J8KGFRvAteLgg6iYSW5g//ql2UUBnQjup/9twFvjQAlaV/IFDBAoIELSsmRKeysX1 2lnVGmp//lIrOjEcTUOLIz02IzkuKZx5dxZHfAuOCdSyYeRiYuYseBbBjtLj9kEANsBW nm0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728246749; x=1728851549; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PZ6/WewJdBdhfP6ZBSehm4FgOeIcxqqUY3isW9WVj+g=; b=WARzecGQyNGDJUbvCPiXxpZaK16XYn8JYAXBzIpjsujmUQ8epSX9xGFhZW3Rs1lGfu dcfSS+pDhEXsbSS4fkfCmv5uEtgbREMyEq6VAZbc89J0nnvirZmca+pu1QmKyXeomu4R o8qhtOFaRECiRljbs4tlut/fydNkRd5Spd892gNbaqi0xAKzFD28t1ysbcJW5nr1AdSt jQi1tiD2ZiQaBKEU5oY2rfzfj0kYEmS9TPw2+shajXECcRTwMYWddlZWBNh39WzzFGR/ GJyZLo1+1/TtkyUCK+waa2G4B9qzUtxLN8DwvOMwbSds+BqTKbE7WTX5dvN1hJ2Nn8WO yC/A== X-Gm-Message-State: AOJu0YzlLaILCxiPKPCRVJQBxWqKGJ73mifH7w1J8is3JXzCRYc3zS7h nudM22Dyzs7aJxfZv7IgMfvrkFEmLYEzL2g54mCrPC0E7WLafxTdZk2GxgN6iAcxZZl/qx7v5ZQ ktoa9/lv5ZQ== X-Google-Smtp-Source: AGHT+IGNqUQaV9xn1xSCdRIQEXM7nz8L9DDLaNQL8tyRkakHmxgj21l2HIWicgVWeoCrSv2AOZt2OhVRA10Y9g== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:f7:ea0b:ac12:11d6]) (user=edumazet job=sendgmr) by 2002:a25:6908:0:b0:e22:624b:aea2 with SMTP id 3f1490d57ef6-e28934fc7a7mr8251276.0.1728246749487; Sun, 06 Oct 2024 13:32:29 -0700 (PDT) Date: Sun, 6 Oct 2024 20:32:20 +0000 In-Reply-To: <20241006203224.1404384-1-edumazet@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241006203224.1404384-1-edumazet@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Message-ID: <20241006203224.1404384-2-edumazet@google.com> Subject: [PATCH v2 net-next 1/5] net: add TIME_WAIT logic to sk_to_full_sk() From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski , Paolo Abeni , Martin KaFai Lau Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet X-Patchwork-Delegate: kuba@kernel.org TCP will soon attach TIME_WAIT sockets to some ACK and RST. Make sure sk_to_full_sk() detects this and does not return a non full socket. Signed-off-by: Eric Dumazet --- include/linux/bpf-cgroup.h | 2 +- include/net/inet_sock.h | 4 +++- net/core/filter.c | 6 +----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h index ce91d9b2acb9f8991150ceead4475b130bead438..f0f219271daf4afea2666c4d09fd4d1a8091f844 100644 --- a/include/linux/bpf-cgroup.h +++ b/include/linux/bpf-cgroup.h @@ -209,7 +209,7 @@ static inline bool cgroup_bpf_sock_enabled(struct sock *sk, int __ret = 0; \ if (cgroup_bpf_enabled(CGROUP_INET_EGRESS) && sk) { \ typeof(sk) __sk = sk_to_full_sk(sk); \ - if (sk_fullsock(__sk) && __sk == skb_to_full_sk(skb) && \ + if (__sk && __sk == skb_to_full_sk(skb) && \ cgroup_bpf_sock_enabled(__sk, CGROUP_INET_EGRESS)) \ __ret = __cgroup_bpf_run_filter_skb(__sk, skb, \ CGROUP_INET_EGRESS); \ diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index f01dd273bea69d2eaf7a1d28274d7f980942b78a..39c5a93b353ad9ac3047031d1718190d749f0530 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h @@ -321,8 +321,10 @@ static inline unsigned long inet_cmsg_flags(const struct inet_sock *inet) static inline struct sock *sk_to_full_sk(struct sock *sk) { #ifdef CONFIG_INET - if (sk && sk->sk_state == TCP_NEW_SYN_RECV) + if (sk && READ_ONCE(sk->sk_state) == TCP_NEW_SYN_RECV) sk = inet_reqsk(sk)->rsk_listener; + if (sk && READ_ONCE(sk->sk_state) == TCP_TIME_WAIT) + sk = NULL; #endif return sk; } diff --git a/net/core/filter.c b/net/core/filter.c index bd0d08bf76bb8de39ca2ca89cda99a97c9b0a034..202c1d386e19599e9fc6e0a0d4a95986ba6d0ea8 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -6778,8 +6778,6 @@ __bpf_sk_lookup(struct sk_buff *skb, struct bpf_sock_tuple *tuple, u32 len, /* sk_to_full_sk() may return (sk)->rsk_listener, so make sure the original sk * sock refcnt is decremented to prevent a request_sock leak. */ - if (!sk_fullsock(sk2)) - sk2 = NULL; if (sk2 != sk) { sock_gen_put(sk); /* Ensure there is no need to bump sk2 refcnt */ @@ -6826,8 +6824,6 @@ bpf_sk_lookup(struct sk_buff *skb, struct bpf_sock_tuple *tuple, u32 len, /* sk_to_full_sk() may return (sk)->rsk_listener, so make sure the original sk * sock refcnt is decremented to prevent a request_sock leak. */ - if (!sk_fullsock(sk2)) - sk2 = NULL; if (sk2 != sk) { sock_gen_put(sk); /* Ensure there is no need to bump sk2 refcnt */ @@ -7276,7 +7272,7 @@ BPF_CALL_1(bpf_get_listener_sock, struct sock *, sk) { sk = sk_to_full_sk(sk); - if (sk->sk_state == TCP_LISTEN && sock_flag(sk, SOCK_RCU_FREE)) + if (sk && sk->sk_state == TCP_LISTEN && sock_flag(sk, SOCK_RCU_FREE)) return (unsigned long)sk; return (unsigned long)NULL; From patchwork Sun Oct 6 20:32:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13823854 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qt1-f201.google.com (mail-qt1-f201.google.com [209.85.160.201]) (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 529C8189F3F for ; Sun, 6 Oct 2024 20:32:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728246753; cv=none; b=Z/gGGTDJyijYIgTUKyQQMUL1/WdsGmn7iuBESURya3N5hktrbYliIp3LD4DmZZpDMAprptZ//kHdLw1ec7aYY1oOJRTAT4nFfKgsLJnbguo5b5Kjn1KxWMJU8xbnoF92livZ7FfGHtV/zSyuEXfv3XJKvSBPv5aVmP/znxENy98= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728246753; c=relaxed/simple; bh=rp97oEAEhfFwX5H4/HTVqnKTKJCEfwfMWzoZIAYnl78=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=oXA2eL7+KJwugFz/lgE1rFbUQVH2sUmGRdJRkBdy8klnMfqjeMIAh84egyYKFwtiIPinVsh78xiTZW5CbAes045Q24FL1SZzCeUteVY+Y0FNlSmEKvwfTjjziE49kzfdrnkZjMFbyWUKpQFVLJH20fMDLdSf9djuQrQFq+GRimM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=kNT3BCZx; arc=none smtp.client-ip=209.85.160.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="kNT3BCZx" Received: by mail-qt1-f201.google.com with SMTP id d75a77b69052e-45826823bb0so68107881cf.1 for ; Sun, 06 Oct 2024 13:32:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728246751; x=1728851551; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=AaWYQlRHCcSGLjzJ6feV2xB2bsNtVl5raNu/3DnomOA=; b=kNT3BCZxLaYuRlKJa+XwySiOB50rvjHGqfkGD/7DQ2QRy19z7p3KmuVM+Hftf+YSPT 7TtGtxldkaBLD+zjV3lV9c/u03NczunVCq1ExwAmoJvaw5gnuvgdy6vS7TsS+XG94p8R AQJ8qfFH42SbLdAsLuOlUeplikEgZhhTqUPWxGMOaWNGlZ/O7uG5l1UT01nYUxKvyujO IEIE87fC9hbzJzYTxIhpV28UwjjLUhyFYu9zYJn3BsNvFUg73XvY3tNl49Dtkq8J1m/v AEe09otR3w1+1RBwOOVwbUr0736Hi26XCkx2ba918Rqtj46ktClX/V6AA1o41QtxdC9U 8TfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728246751; x=1728851551; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AaWYQlRHCcSGLjzJ6feV2xB2bsNtVl5raNu/3DnomOA=; b=hDz/GSChFMyqiJw6eWaQwoYj0/9R4t19V0dc7u7HBW1+QoPe+qWQA4TXsZb0fUJrxy PK4oKOd0jdTJpaDLjMNJNmxLf4Q6R3a9oMws3xcWh54McS213F4d4m2UVwsPwulOKHrJ QcCBaJ50EHqDhPZCOQZiIxQYqb8mMz/DgX/S6Abrktw2CwwNL5PlDuXeIifemIk1vhtP ljFZWVbjPCh3dPUV7bmCHs+VdZw8Jx0n4JLZ47HBRkvWbuXTwk9X1Gth5sgfyX4EBG9p r6J/1EbX0n0tWutBAnnEl8H6bYlVls+U6SuNgng0PxZ5sqAmBuWcnwYpVA+XxPaUqH8X ceRQ== X-Gm-Message-State: AOJu0YxhQMIlsSl669+0HuTKtx+UfZPe6D2GRxtkO1q/UP8WmWVlXCMt P1Clf3EWTAcotTl3R9I2CNDR5k3eEOMbtreYgaWBUIrveh720hxP2TzjF/fl/WqR/K+qDAhnpfz Q1aPsmfXNvg== X-Google-Smtp-Source: AGHT+IG9n9/t6TEjbNtdpfIWnE/fT+avYBhvKT4QLPdXtgvqhAlcUYfgx62W4DFuyP89aoN0m5ftAxe4K3aCBw== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:f7:ea0b:ac12:11d6]) (user=edumazet job=sendgmr) by 2002:ac8:4a17:0:b0:458:493a:4995 with SMTP id d75a77b69052e-45d9bb187e9mr74441cf.11.1728246751092; Sun, 06 Oct 2024 13:32:31 -0700 (PDT) Date: Sun, 6 Oct 2024 20:32:21 +0000 In-Reply-To: <20241006203224.1404384-1-edumazet@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241006203224.1404384-1-edumazet@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Message-ID: <20241006203224.1404384-3-edumazet@google.com> Subject: [PATCH v2 net-next 2/5] net_sched: sch_fq: prepare for TIME_WAIT sockets From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski , Paolo Abeni , Martin KaFai Lau Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet X-Patchwork-Delegate: kuba@kernel.org TCP stack is not attaching skb to TIME_WAIT sockets yet, but we would like to allow this in the future. Add sk_listener_or_tw() helper to detect the three states that FQ needs to take care. Like NEW_SYN_RECV, TIME_WAIT are not full sockets and do not contain sk->sk_pacing_status, sk->sk_pacing_rate. Signed-off-by: Eric Dumazet --- include/net/sock.h | 10 ++++++++++ net/sched/sch_fq.c | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/net/sock.h b/include/net/sock.h index e282127092aba205c038046e1e8078cf2582c075..562bb47bf3d8a58f31576a66811ffb25dfed1a8b 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2800,6 +2800,16 @@ static inline bool sk_listener(const struct sock *sk) return (1 << sk->sk_state) & (TCPF_LISTEN | TCPF_NEW_SYN_RECV); } +/* This helper checks if a socket is a LISTEN or NEW_SYN_RECV or TIME_WAIT + * TCP SYNACK messages can be attached to LISTEN or NEW_SYN_RECV (depending on SYNCOOKIE) + * TCP RST and ACK can be attached to TIME_WAIT. + */ +static inline bool sk_listener_or_tw(const struct sock *sk) +{ + return (1 << READ_ONCE(sk->sk_state)) & + (TCPF_LISTEN | TCPF_NEW_SYN_RECV | TCPF_TIME_WAIT); +} + void sock_enable_timestamp(struct sock *sk, enum sock_flags flag); int sock_recv_errqueue(struct sock *sk, struct msghdr *msg, int len, int level, int type); diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c index aeabf45c9200c4aea75fb6c63986e37eddfea5f9..a97638bef6da5be8a84cc572bf2372551f4b7f96 100644 --- a/net/sched/sch_fq.c +++ b/net/sched/sch_fq.c @@ -362,8 +362,9 @@ static struct fq_flow *fq_classify(struct Qdisc *sch, struct sk_buff *skb, * 3) We do not want to rate limit them (eg SYNFLOOD attack), * especially if the listener set SO_MAX_PACING_RATE * 4) We pretend they are orphaned + * TCP can also associate TIME_WAIT sockets with RST or ACK packets. */ - if (!sk || sk_listener(sk)) { + if (!sk || sk_listener_or_tw(sk)) { unsigned long hash = skb_get_hash(skb) & q->orphan_mask; /* By forcing low order bit to 1, we make sure to not From patchwork Sun Oct 6 20:32:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13823855 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (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 5CD3218A95D for ; Sun, 6 Oct 2024 20:32:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728246754; cv=none; b=faS2zwyQ/RDxrNixMrDEfqfCd+c2ER9TvQLE/QkbqZZ1oVm7E5OfJmvMlvM5DefalQtIAgGxpvMykjn/lijwCYjJ/nCv6c2qwSYqFgmv7GxskPRmCt+pZsDNg93NL5JCr9eg9wohxpRe1olmKnK2H4R7KirXvVMFRpoiZnOOno4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728246754; c=relaxed/simple; bh=2D8rkK6G7fg6pTqt3zPivlNXZN/I4VKO0r4n8jFuur8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Tu5Jo2bN3oVXckG+Gi1NtGfjTEtMAvU7NIr7BOOCx+iDDgzDlNtu+FhGfWoi41ACtjoq6PjVFquoqg4UfiAB5lN1vsNjGlmhM6Ts6xo8/QzA29FvIKXVRtI9YpX8tCRRHXl+iBXaWQKs9MS8PTZVc8a0VeCOayFR4VH9rfYZ0tg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=vO3t9osn; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="vO3t9osn" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e20e22243dso5648377b3.1 for ; Sun, 06 Oct 2024 13:32:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728246752; x=1728851552; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=nzaMe9nGRzd2Bab5mcUyBD5Y+/aRG6rpLBHUK8GLFL8=; b=vO3t9osnsX6m/I42u0n4eS6LO8HDTWoZsWsk97W21/MdTFktVApdN6sknDvCF6fhda QEhUNvd7WQxc95qF8QP74PFgz9bsUVTLtDQ+2Bk3H8qnSg55O7j5k5R1arwd/s7iaVbo Tt6/6Pzjw4RihB/rj5nB5/tzTbkxOh/Tkl6znmEOKvd19EfypWtBeIR5l6c8l8Zycxru MpCQ4vZOM5xitng6ZsHesYwmCHw/QLm1K/RDhuqhiQiPgR8VWwBHWYwdi+GjDw6uV0/o irkAUq8/bHzm5bwItGTequrk5Tk5klICeWndBDWgsG1nYfI+JOqWJTr2luEy/KnYxuDX 3mwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728246752; x=1728851552; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nzaMe9nGRzd2Bab5mcUyBD5Y+/aRG6rpLBHUK8GLFL8=; b=xFmCY0Ow66kDQ/mw7pCTqHXM0eAawuUpDHzGOLj9SnzKo9K106StZpxDnyEePKW8aK zx6+8romrBR/2COaD5Sb0vOm19HO8di2bqZjpkDsd97/VO3lWbR0LEz0m7kI29O/H85W KBhOSIMDsrx5zMOb1sWXJt5P/BsMn1TzEiprL6na6MPwqhi+zZK9XihD8lGlK8w5C1DA GKaGbJVozNOMKPC6Axymc5Egl2n/zhwi9V7sNkxaSlT0g+Pb4EXGQim7KGh+CwXMjwRc 9pigtQbPNShISEe0IjRktWpPEJNmEWbpV/rN16FnOHNPDsx0LRonScAZiccxD0C2mfkh 7umQ== X-Gm-Message-State: AOJu0Yx6uZYWhmF/s2LvEWMzNYsnDFSGFW7QIsqWH7mR3uiMofNJuzaZ kaDdTrYRDcB1hbh2Q/SF1ToAxhcd7p8qEw3cKmM1XBW1F41Z3fLF85Tqk9/vmncI7y1da90QngN cn+Uj4xG8NA== X-Google-Smtp-Source: AGHT+IEh5ELrxrSik9+rUjwIE5nWJ6l7Im2F87HzfWohFEPzc4kKunEE6oVAPdZqUL9vdcn0kJe+hFxROcXX8w== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:f7:ea0b:ac12:11d6]) (user=edumazet job=sendgmr) by 2002:a25:848d:0:b0:e11:5e87:aa9 with SMTP id 3f1490d57ef6-e2893939442mr6596276.8.1728246752252; Sun, 06 Oct 2024 13:32:32 -0700 (PDT) Date: Sun, 6 Oct 2024 20:32:22 +0000 In-Reply-To: <20241006203224.1404384-1-edumazet@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241006203224.1404384-1-edumazet@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Message-ID: <20241006203224.1404384-4-edumazet@google.com> Subject: [PATCH v2 net-next 3/5] net: add skb_set_owner_edemux() helper From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski , Paolo Abeni , Martin KaFai Lau Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet X-Patchwork-Delegate: kuba@kernel.org This can be used to attach a socket to an skb, taking a reference on sk->sk_refcnt. This helper might be a NOP if sk->sk_refcnt is zero. Use it from tcp_make_synack(). Signed-off-by: Eric Dumazet --- include/net/sock.h | 9 +++++++++ net/core/sock.c | 9 +++------ net/ipv4/tcp_output.c | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index 562bb47bf3d8a58f31576a66811ffb25dfed1a8b..eaa42e20449c83465fc378f5e66b2c11929708fd 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1758,6 +1758,15 @@ void sock_efree(struct sk_buff *skb); #ifdef CONFIG_INET void sock_edemux(struct sk_buff *skb); void sock_pfree(struct sk_buff *skb); + +static inline void skb_set_owner_edemux(struct sk_buff *skb, struct sock *sk) +{ + skb_orphan(skb); + if (refcount_inc_not_zero(&sk->sk_refcnt)) { + skb->sk = sk; + skb->destructor = sock_edemux; + } +} #else #define sock_edemux sock_efree #endif diff --git a/net/core/sock.c b/net/core/sock.c index 846f494a17cf9614bb96505eec743df17574c138..d540acc8b154052ca523853b67056ebb0097c68e 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -2594,14 +2594,11 @@ void __sock_wfree(struct sk_buff *skb) void skb_set_owner_w(struct sk_buff *skb, struct sock *sk) { skb_orphan(skb); - skb->sk = sk; #ifdef CONFIG_INET - if (unlikely(!sk_fullsock(sk))) { - skb->destructor = sock_edemux; - sock_hold(sk); - return; - } + if (unlikely(!sk_fullsock(sk))) + return skb_set_owner_edemux(skb, sk); #endif + skb->sk = sk; skb->destructor = sock_wfree; skb_set_hash_from_sk(skb, sk); /* diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 08772395690d13a0c3309a273543a51aa0dd3fdc..20d6adb919461849ebda30c30f018ae8c5d5861a 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -3731,7 +3731,7 @@ struct sk_buff *tcp_make_synack(const struct sock *sk, struct dst_entry *dst, switch (synack_type) { case TCP_SYNACK_NORMAL: - skb_set_owner_w(skb, req_to_sk(req)); + skb_set_owner_edemux(skb, req_to_sk(req)); break; case TCP_SYNACK_COOKIE: /* Under synflood, we do not attach skb to a socket, From patchwork Sun Oct 6 20:32:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13823856 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (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 BBDB018BB83 for ; Sun, 6 Oct 2024 20:32:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728246756; cv=none; b=mZEQazNCoeOAyBL1SKzA5kPEYYT2U34z6Xsqy2lOM7DrTh99ZJe3raF2UVDzwj10Nt/6eDHAdzUOv8i4wR1fSiiK2V6dU0c7NTnwkScJMathKVwg1837y27j6GQNOyMWZ0+n+q9fB/UUwQndaYII5ydDilLlOLLyWp6+M4ZDXAI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728246756; c=relaxed/simple; bh=5CD2vHD4iDomFD+zRyMXHslj/7EkOIstZWGcRfg/YVk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=EEygihtaz+QZD3iiFbipuBb3CC/nbo9EUrA+wmwsUkOAWDriN11RovdlSJC2FDzVZBudZ0TgGjYr4u/2ILdM1QN6ScCgcyx77eOLvZhqMh4CKcZ8fvG0weNRTR6N2AFJC7TJVaMXUctH6qcVw0B1Yb+TbfD0+X9C/sKFYc7urYg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=dZUXsusz; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="dZUXsusz" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e035949cc4eso5555450276.1 for ; Sun, 06 Oct 2024 13:32:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728246754; x=1728851554; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=IqdflWDTEWZXIQHuvOe+TKvfOK+KjwD2ecbuIHYqymE=; b=dZUXsuszgQ4GgZpY/+5el/ASjtPRdYGkylX3RQzWXLkltiXS3uznMRLxCUKIY2D6p9 p78Oc/PyhYFXVcnqTnVWC0zgP770iIDBWnrz+82GnWDP0lvKfPborIRvUCeBvBVwTgQv w8mNBqIiysi3my1B9P2i9YZLIaFeIZ5thbEGDFBoVBvdS0d6yCynnDN6nf/tOjTvID0Z Q78fwMBPwbyGvtSe547ub3z968ON6o3ib/GfxseeJC6gcRM1VxetRuKB6v+hYVhV0YFu aKn1rF6Zu9YBqfC31FkggmBJjXHY+aCyNZBwnQSW1wgDOx4U3fh4qTbUuSKPllt46g/X vFSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728246754; x=1728851554; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IqdflWDTEWZXIQHuvOe+TKvfOK+KjwD2ecbuIHYqymE=; b=uo0e9WEC7x4rgmkbqQtFqmq1h6u4PrU1Ua1xBuZvyqN3gl5mwQaGDcifn8g93Bk2BU fdcZjHFz0BrvKR27dTFe8fEQnVWZKwZeEosGgQkUWkCMuk9eAePPvlxJQkLSqDqN0utv ojSC/Env9dxuhtMPr/nwd6K4M3lr1qMuz9K62whjF0In8VLNKJoeTnj4cZxNbi+RE5Gr 9SPCDucki7my39qGbU3UPjp2lnF8Vkpl1NCD71frNrbITGnZxCzV4CRIaFnGFMTJdY2H 3/Q1xhLPRUiVRfcLOm0FBjnD0aDPwbGqhW8sl2qhlwj9Z/pPvy6gefCrT1BfmQmCxhU3 kg6w== X-Gm-Message-State: AOJu0YxpGSVHu/P5S6QqAgInc41lI5ti7rLFPiyUECgTCFEauG6/34Le s/iefVGa+JXDIolM0F/qEKhZ7YNaUrl4QgvMHfLbNLPMr6aHyKHnJ4jDpnLVGqB95fAOOIbZO1s rWXI8Wz5+lw== X-Google-Smtp-Source: AGHT+IE2dhJauz50GUa4VOaoSWyhGjoYs5dr/ymimpTCgYApfat/GtdBCWrPNJM+v3mm9mqBHuM0LnI+oz8hhA== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:f7:ea0b:ac12:11d6]) (user=edumazet job=sendgmr) by 2002:a25:84c4:0:b0:e11:69f2:e39 with SMTP id 3f1490d57ef6-e28939399d5mr29734276.9.1728246753851; Sun, 06 Oct 2024 13:32:33 -0700 (PDT) Date: Sun, 6 Oct 2024 20:32:23 +0000 In-Reply-To: <20241006203224.1404384-1-edumazet@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241006203224.1404384-1-edumazet@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Message-ID: <20241006203224.1404384-5-edumazet@google.com> Subject: [PATCH v2 net-next 4/5] ipv6: tcp: give socket pointer to control skbs From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski , Paolo Abeni , Martin KaFai Lau Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet X-Patchwork-Delegate: kuba@kernel.org tcp_v6_send_response() send orphaned 'control packets'. These are RST packets and also ACK packets sent from TIME_WAIT. Some eBPF programs would prefer to have a meaningful skb->sk pointer as much as possible. This means that TCP can now attach TIME_WAIT sockets to outgoing skbs. Signed-off-by: Eric Dumazet --- net/ipv6/tcp_ipv6.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 7634c0be6acbdb67bb378cc81bdbf184552d2afc..597920061a3a061a878bf0f7a1b03ac4898918a9 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -967,6 +967,9 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32 } if (sk) { + /* unconstify the socket only to attach it to buff with care. */ + skb_set_owner_edemux(buff, (struct sock *)sk); + if (sk->sk_state == TCP_TIME_WAIT) mark = inet_twsk(sk)->tw_mark; else From patchwork Sun Oct 6 20:32:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13823857 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (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 5C85E18A95D for ; Sun, 6 Oct 2024 20:32:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728246757; cv=none; b=cXRZMixFGH2UZa88a7a2LiiHzsqGW2AEi+immxTWh/I8EHtCzG8hndXn+pe60G4WVDCSMq9vRYa+58mq+FwUreuUjaY7cfxU0IUDj0y1mDohJVC7iPim86kY7rfDH6Ozpr8FS4pxjfLkqXDVJXV8iXiSM1hlurDDnrBh0kWC/aQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728246757; c=relaxed/simple; bh=CzptCRZ+80Rz3LavDf81jJ10UlDXiTs0J2jCDtr/szU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ivQKJmKJNBGOUeSIvkF82vELzxOqyTVh+MomusX6hD5FppMsTohITqiZWQafUN3SFX8qoCitBolx96GlfHzXxkWs9kvH+ZSQlo1ZJLKh9e3KNmb8SBy5ybPO/hq8F8zi1/o1afvFMIj+mwtdeFZfNoLeAv7T1qROjtA3FMWtqyA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ATiS1bKs; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ATiS1bKs" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6e24e37f1eeso78731617b3.0 for ; Sun, 06 Oct 2024 13:32:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728246755; x=1728851555; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=F9giHI7mOzs1A14Xi8IWFiG1R65fEJzdr2/Je30Sg2w=; b=ATiS1bKsbK1RCIGCyfGrtw4BfBSYE55pzvrQMit8HxPs/aMWbgI0D5lvZghi1VaQP6 /YwcRER2Otal4tOQCHUGPjCyQzUbuT/mEsid00Gu6VOovzr/sTKpD5inQa3s/th35743 7SoE1qImy1JmSbqG7MO89L9Sy4lF5plz/kSNpHiJ9w8QQ0hbc8qSPu9bQjR17xIsJuoc yG3V+3d8FAbCN/ncS3h1lHPGR0NAg8kza0Vb7CkYy2WTST2A8YMUo8UcEE8TTaX8QqCF Q8xzEbUtvnQUiU3D9myH8Db/ugWGk+5jLspe9G/Ui4Ykqfad1ddSwBIGlaOx7ay6eJW4 X20w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728246755; x=1728851555; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=F9giHI7mOzs1A14Xi8IWFiG1R65fEJzdr2/Je30Sg2w=; b=ULogFdB1UdMUOr+bnz/vH/IYPXcrnc2o83kmSJ4NQJCiaRAkEsyoa5bevkYG7ww7qM M+9xg1mc1BtsKvUn5AwYcOl52ZvQo6DeTgPLgP/dmlWGUOTxTYzTsw5d1PXQVSHFlxaX KdhnXk37CrFk4tzvHCUvXGXRdWFYqhPXCMuTI3RMjH3CUKfLU0MSnYFmQRVSYQcCWUin 1Tl/k4nSLrB43XvJ9yo0Ab3AF8iKeEa9wNRQALqE5lqIwj+pB0B35nb9fLmb6wVKe10j jAoin1Bj5dBv0DvJsl6ChdVDfFQ+0gGpW86PbUL/tA27Ki460e+xTtmeR/F+748aghgP 9ORg== X-Gm-Message-State: AOJu0Yy1GVbIGTFP7dg2hzeZZjelfXfzM3j4sKk8adslMHnQSxg1d38Q Tz7D5uDFfhG4DP6s7dXcbiLcZafDBY1cqf0rxOjlAePy1vnqSIOGePvSZV/64sNqjo+KwStNgeV R1JydHAmeSw== X-Google-Smtp-Source: AGHT+IGGlGGY16wFGeshUS9ggEyCxYcNGzQOu45QxRuRETxFWi1v+oYNGogxmEp8mQsdShthMIyJJkRNrhDYrw== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:f7:ea0b:ac12:11d6]) (user=edumazet job=sendgmr) by 2002:a25:ae8a:0:b0:e28:8591:2655 with SMTP id 3f1490d57ef6-e28934f6b47mr8175276.0.1728246755395; Sun, 06 Oct 2024 13:32:35 -0700 (PDT) Date: Sun, 6 Oct 2024 20:32:24 +0000 In-Reply-To: <20241006203224.1404384-1-edumazet@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241006203224.1404384-1-edumazet@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Message-ID: <20241006203224.1404384-6-edumazet@google.com> Subject: [PATCH v2 net-next 5/5] ipv4: tcp: give socket pointer to control skbs From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski , Paolo Abeni , Martin KaFai Lau Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet X-Patchwork-Delegate: kuba@kernel.org ip_send_unicast_reply() send orphaned 'control packets'. These are RST packets and also ACK packets sent from TIME_WAIT. Some eBPF programs would prefer to have a meaningful skb->sk pointer as much as possible. This means that TCP can now attach TIME_WAIT sockets to outgoing skbs. Signed-off-by: Eric Dumazet --- include/net/ip.h | 3 ++- net/ipv4/ip_output.c | 5 ++++- net/ipv4/tcp_ipv4.c | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/net/ip.h b/include/net/ip.h index bab084df15677543b7400bb2832c0e83988884cb..4be0a6a603b2b5d5cfddc045a7d49d0d77be9570 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -288,7 +288,8 @@ static inline __u8 ip_reply_arg_flowi_flags(const struct ip_reply_arg *arg) return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0; } -void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, +void ip_send_unicast_reply(struct sock *sk, const struct sock *orig_sk, + struct sk_buff *skb, const struct ip_options *sopt, __be32 daddr, __be32 saddr, const struct ip_reply_arg *arg, diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index e5c55a95063dd8340f9a014102408e859b4eb755..0065b1996c947078bea210c9abe5c80fa0e0ab4f 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -1596,7 +1596,8 @@ static int ip_reply_glue_bits(void *dptr, char *to, int offset, * Generic function to send a packet as reply to another packet. * Used to send some TCP resets/acks so far. */ -void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, +void ip_send_unicast_reply(struct sock *sk, const struct sock *orig_sk, + struct sk_buff *skb, const struct ip_options *sopt, __be32 daddr, __be32 saddr, const struct ip_reply_arg *arg, @@ -1662,6 +1663,8 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, arg->csumoffset) = csum_fold(csum_add(nskb->csum, arg->csum)); nskb->ip_summed = CHECKSUM_NONE; + if (orig_sk) + skb_set_owner_edemux(nskb, (struct sock *)orig_sk); if (transmit_time) nskb->tstamp_type = SKB_CLOCK_MONOTONIC; if (txhash) diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 985028434f644c399e51d12ba8d9c2c5740dc6e1..9d3dd101ea713b14e13afe662baa49d21b3b716c 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -907,7 +907,7 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb, ctl_sk->sk_mark = 0; ctl_sk->sk_priority = 0; } - ip_send_unicast_reply(ctl_sk, + ip_send_unicast_reply(ctl_sk, sk, skb, &TCP_SKB_CB(skb)->header.h4.opt, ip_hdr(skb)->saddr, ip_hdr(skb)->daddr, &arg, arg.iov[0].iov_len, @@ -1021,7 +1021,7 @@ static void tcp_v4_send_ack(const struct sock *sk, ctl_sk->sk_priority = (sk->sk_state == TCP_TIME_WAIT) ? inet_twsk(sk)->tw_priority : READ_ONCE(sk->sk_priority); transmit_time = tcp_transmit_time(sk); - ip_send_unicast_reply(ctl_sk, + ip_send_unicast_reply(ctl_sk, sk, skb, &TCP_SKB_CB(skb)->header.h4.opt, ip_hdr(skb)->saddr, ip_hdr(skb)->daddr, &arg, arg.iov[0].iov_len,