netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jon Maxwell <jmaxwell37@gmail.com>, davem@davemloft.net
Cc: kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	jmaxwell@redhat.com
Subject: Re: [PATCH net-next v1] tcp: Add mark for TIMEWAIT sockets
Date: Wed, 9 May 2018 22:45:16 -0700	[thread overview]
Message-ID: <eece810c-b3c8-4307-c03a-1cfdaa7109de@gmail.com> (raw)
In-Reply-To: <20180510052111.17886-1-jmaxwell37@gmail.com>



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 ?

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);

  reply	other threads:[~2018-05-10  5:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-10  5:21 [PATCH net-next v1] tcp: Add mark for TIMEWAIT sockets Jon Maxwell
2018-05-10  5:45 ` Eric Dumazet [this message]
2018-05-10  6:14   ` Jonathan Maxwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eece810c-b3c8-4307-c03a-1cfdaa7109de@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jmaxwell37@gmail.com \
    --cc=jmaxwell@redhat.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).