netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
To: Florian Westphal <fw@strlen.de>, netdev@vger.kernel.org
Cc: eric.dumazet@gmail.com
Subject: Re: [PATCH v2 -next 3/3] tcp: honour SO_BINDTODEVICE for TW_RST case too
Date: Tue, 22 Dec 2015 22:47:00 +0100	[thread overview]
Message-ID: <5679C4D4.50804@stressinduktion.org> (raw)
In-Reply-To: <1450729766-14926-4-git-send-email-fw@strlen.de>

On 21.12.2015 21:29, Florian Westphal wrote:
> Hannes points out that when we generate tcp reset for timewait sockets we
> pretend we found no socket and pass NULL sk to tcp_vX_send_reset().
> 
> Make it cope with inet tw sockets and then provide tw sk.
> 
> This makes RSTs appear on correct interface when SO_BINDTODEVICE is used.
> 
> Packetdrill test case:
> // want default route to be used, we rely on BINDTODEVICE
> `ip route del 192.0.2.0/24 via 192.168.0.2 dev tun0`
> 
> 0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
> // test case still works due to BINDTODEVICE
> 0.001 setsockopt(3, SOL_SOCKET, SO_BINDTODEVICE, "tun0", 4) = 0
> 0.100...0.200 connect(3, ..., ...) = 0
> 
> 0.100 > S 0:0(0) <mss 1460,sackOK,nop,nop>
> 0.200 < S. 0:0(0) ack 1 win 32792 <mss 1460,sackOK,nop,nop>
> 0.200 > . 1:1(0) ack 1
> 
> 0.210 close(3) = 0
> 
> 0.210 > F. 1:1(0) ack 1 win 29200
> 0.300 < . 1:1(0) ack 2 win 46
> 
> // more data while in FIN_WAIT2, expect RST
> 1.300 < P. 1:1001(1000) ack 1 win 46
> 
> // fails without this change -- default route is used
> 1.301 > R 1:1(0) win 0
> 
> Reported-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Signed-off-by: Florian Westphal <fw@strlen.de>

Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>

Tested and works fine, thanks Florian and Eric!

  parent reply	other threads:[~2015-12-22 21:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-21 20:29 [PATCH v2 -next 0/3] tcp: honour SO_BINDTODEVICE for TW_RST case too Florian Westphal
2015-12-21 20:29 ` [PATCH -next 1/3] net: add inet_sk_transparent() helper Florian Westphal
2015-12-22 19:04   ` Eric Dumazet
2015-12-22 21:46   ` Hannes Frederic Sowa
2015-12-21 20:29 ` [PATCH -next 2/3] tcp: send_reset: test for non-NULL sk first Florian Westphal
2015-12-22 19:05   ` Eric Dumazet
2015-12-22 21:46   ` Hannes Frederic Sowa
2015-12-21 20:29 ` [PATCH v2 -next 3/3] tcp: honour SO_BINDTODEVICE for TW_RST case too Florian Westphal
2015-12-22 19:06   ` Eric Dumazet
2015-12-22 21:47   ` Hannes Frederic Sowa [this message]
2015-12-22 22:03 ` [PATCH v2 -next 0/3] " David Miller

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=5679C4D4.50804@stressinduktion.org \
    --to=hannes@stressinduktion.org \
    --cc=eric.dumazet@gmail.com \
    --cc=fw@strlen.de \
    --cc=netdev@vger.kernel.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).