Received: by 10.192.165.148 with SMTP id m20csp749806imm; Wed, 9 May 2018 23:15:52 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqvqcLKO8e8y7HsbP3eXG977ntdC12q1Mn4gKi9SiDqBI4fisiVf05aCEu1YxwzpTNkp4QF X-Received: by 2002:a17:902:bc88:: with SMTP id bb8-v6mr111183plb.175.1525932952801; Wed, 09 May 2018 23:15:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525932952; cv=none; d=google.com; s=arc-20160816; b=h6YPq38zdcCCcGPtkKUzauB+X5KWU8MdnOqZW/Z4aozaOchG6aflgkwoYYls2c+Q8I PqWFBrWv/6NLVtim1pG8v3AHNAcs92Om9ngSqkk4wodDqBhuV/sjV1Hlfwf9BflqHyX+ GKaCWj3flxbkTRhrD652vzQs72DT1M7RC5JvyejuTQrKlPZeKT4LDy6L3CEf6t+3KySg WeDjD19D0Lr3BfKDQESvPLmjfsmL1wAIAr0VT8TLOzeCu6kCcz5gY6hkiM8g2pyzzcn4 aYJBqQDkxcxGHHcOKospM28+QkpT4E0phoI3O9gFCimK2VKidhCBwkI/dig1DnkrvFU8 k2Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=rhMFqgq4q0JENwHOxiH8r9p97cQfqYHSEvAaksufAZw=; b=IrganXRxV8/RvmmANh6XINkj+KUm60O60xETwfa6aO3eKcVrL4t3pHxUXb7Hh5M+LZ Ee0a7nUd+uf5QMkeXmirarG6vz9+AVF+ABiyG1qBVD3Svff0fxRlkU4c7DhQBJOtb2Xv cCjCfKR4vlRgEDb26SS4XmajcIjERpwIuTh2aHSUVVEdgtvv8Lp4jFcWmtLLop8X+H3B PJw1qV4wSDcE24Go0durZzxnMPKROguSsj6+PKX6ZK340jPbbPpFb/vI7IR8JhPzqKmf o9I5iKL+VIrx6nfNUT2cMr/ZGq13PrUetnozV985K8WHSsrw02MrGMvbpQHVMYEO7kZP Kp3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JHWut1O9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9-v6si67640pli.427.2018.05.09.23.15.37; Wed, 09 May 2018 23:15:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JHWut1O9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756624AbeEJGP0 (ORCPT + 99 others); Thu, 10 May 2018 02:15:26 -0400 Received: from mail-wr0-f176.google.com ([209.85.128.176]:37744 "EHLO mail-wr0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751313AbeEJGPZ (ORCPT ); Thu, 10 May 2018 02:15:25 -0400 Received: by mail-wr0-f176.google.com with SMTP id h5-v6so782304wrm.4; Wed, 09 May 2018 23:15:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=rhMFqgq4q0JENwHOxiH8r9p97cQfqYHSEvAaksufAZw=; b=JHWut1O9MhmVqrnbu3rJxts6XLS2ism3vmq238OoGJioj28S3zHZcqdKrfrCfa1FsR m3pyyF+kX10XtoAF6f6GTKk0ZHQwK3YIGqD8oVmlg3MEFwlkq/U/Ho+mPWKt7IwWiJJx HVXnejS7NU6cyPwlG/ly5wG8xLN6B5U4TTWYEmwtPRIgDnTIKVMtuCbw4/yGpfADawhc KkHB7azLyWFGLrOKmLq2y63Oqv6VSHIHUJBCBgXxrk4f1hjlICnV1mtDJtQmUvBpBSNt 4PQKyvpLFVW+EDYsxqHcA35EUPmCIZ21Y5tJrRd+inNGkUBGeiQPuhWTxAXy0rbImgP1 xJSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=rhMFqgq4q0JENwHOxiH8r9p97cQfqYHSEvAaksufAZw=; b=jRW8QRJKJy59/xQa3pyiRsUvyhcaUlWmmgz/PzyU5p/2zPDUhFaEkUpFcOz+EwlzX8 exVMGG4P25Xd7usvvsm6gI/QjLd6YmvUIN/7FuXS3XAI486QUb9RYeBk/HBzKJ0ydO+1 CqWWweczB8RH6/lp11QMhS6ngVAz8R32F4v0UYzNjVfMkJ7C7jiz69I8rxtlayZ2xNlV dBSCqm6AQRrf+V4xuNOwnAYlPUYcCPWbdfRqmBn6AqHY8p7tge0zONrOmNaZ2A+/5NNi 1VRn8B8XVgxua11ykTU4ozKTh9xnWNAZMwL7fuaei+APYE+GIxL0mJ2wSUvxFH5CMl/Q dXJA== X-Gm-Message-State: ALKqPwe9AjPTvsWpd+mCvAYxqB6yH9vYQDNDrXjr5Hbu9vxWggsLufR8 w5yr7pkQfsOKzXpsb58IZYLmQTFE1orxGfQMLIg= X-Received: by 2002:adf:ad2d:: with SMTP id p42-v6mr121548wrc.164.1525932924034; Wed, 09 May 2018 23:15:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.113.143 with HTTP; Wed, 9 May 2018 23:14:43 -0700 (PDT) In-Reply-To: References: <20180510052111.17886-1-jmaxwell37@gmail.com> From: Jonathan Maxwell Date: Thu, 10 May 2018 16:14:43 +1000 Message-ID: Subject: Re: [PATCH net-next v1] tcp: Add mark for TIMEWAIT sockets To: Eric Dumazet Cc: David Miller , kuznet , yoshfuji , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jon Maxwell Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 10, 2018 at 3:45 PM, Eric Dumazet wrote: > > > On 05/09/2018 10:21 PM, Jon Maxwell wrote: > > ... > >> if (th->rst) >> @@ -723,11 +724,17 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb) >> arg.tos = ip_hdr(skb)->tos; >> arg.uid = sock_net_uid(net, sk && sk_fullsock(sk) ? sk : NULL); >> local_bh_disable(); >> - ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk), >> + ctl_sk = *this_cpu_ptr(net->ipv4.tcp_sk); >> + if (sk && sk->sk_state == TCP_TIME_WAIT) >> + ctl_sk->sk_mark = inet_twsk(sk)->tw_mark; >> + else if (sk && sk_fullsock(sk)) > > I do not believe we could have a non fullsock here ? > Okay thanks I'll make these changes to v2. > A request socket (SYN_RECV state) at this point is not expected. > > > So you can factorize : > > if (sk) > ctl_sk->sk_mark = (sk->sk_state == TCP_TIME_WAIT) ? > inet_twsk(sk)->tw_mark : sk->sk_mark; > > (same remark for IPv6) > > >> + ctl_sk->sk_mark = sk->sk_mark; >> + ip_send_unicast_reply(ctl_sk, >> skb, &TCP_SKB_CB(skb)->header.h4.opt, >> ip_hdr(skb)->saddr, ip_hdr(skb)->daddr, >> &arg, arg.iov[0].iov_len); > >