]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ipv6: tcp: give socket pointer to control skbs
authorEric Dumazet <edumazet@google.com>
Thu, 10 Oct 2024 17:48:16 +0000 (17:48 +0000)
committerJakub Kicinski <kuba@kernel.org>
Tue, 15 Oct 2024 00:39:37 +0000 (17:39 -0700)
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 <edumazet@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Brian Vazquez <brianvv@google.com>
Link: https://patch.msgid.link/20241010174817.1543642-5-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv6/tcp_ipv6.c

index 7634c0be6acbdb67bb378cc81bdbf184552d2afc..597920061a3a061a878bf0f7a1b03ac4898918a9 100644 (file)
@@ -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