From: Florian Westphal <fw@strlen.de>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Florian Westphal <fw@strlen.de>, netdev@vger.kernel.org
Subject: Re: [PATCH -next] tcp: honour SO_BINDTODEVICE for TW_RST case too
Date: Mon, 21 Dec 2015 19:56:20 +0100 [thread overview]
Message-ID: <20151221185620.GB9692@breakpoint.cc> (raw)
In-Reply-To: <1450718113.8474.132.camel@edumazet-glaptop2.roam.corp.google.com>
Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > - net = sk ? sock_net(sk) : dev_net(skb_dst(skb)->dev);
> > + have_full_sk = sk && sk_fullsock(sk);
> > + net = have_full_sk ? sock_net(sk) : dev_net(skb_dst(skb)->dev);
>
> But the net pointer can be derived from timewait the same, not sure why
> you changed this part ... This makes your patch look more complicated
> than what is needed.
Duh, you're right -- I'll send a V2.
> > #ifdef CONFIG_TCP_MD5SIG
> > hash_location = tcp_parse_md5sig_option(th);
> > - if (!sk && hash_location) {
> > + if (have_full_sk) {
> > + key = tcp_md5_do_lookup(sk, (union tcp_md5_addr *)
> > + &ip_hdr(skb)->saddr, AF_INET);
> > + } else if (hash_location) {
> > /*
> > * active side is lost. Try to find listening socket through
> > * source port, and then find md5 key through listening socket.
> > @@ -651,10 +656,6 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb)
> > genhash = tcp_v4_md5_hash_skb(newhash, key, NULL, skb);
> > if (genhash || memcmp(hash_location, newhash, 16) != 0)
> > goto release_sk1;
> > - } else {
> > - key = sk ? tcp_md5_do_lookup(sk, (union tcp_md5_addr *)
> > - &ip_hdr(skb)->saddr,
> > - AF_INET) : NULL;
> > }
> >
> > if (key) {
> > @@ -675,7 +676,14 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb)
> > ip_hdr(skb)->saddr, /* XXX */
> > arg.iov[0].iov_len, IPPROTO_TCP, 0);
> > arg.csumoffset = offsetof(struct tcphdr, check) / 2;
> > - arg.flags = (sk && inet_sk(sk)->transparent) ? IP_REPLY_ARG_NOSRCCHECK : 0;
> > + arg.flags = 0;
> > + if (have_full_sk) {
> > + if (inet_sk(sk)->transparent)
> > + arg.flags = IP_REPLY_ARG_NOSRCCHECK;
> > + } else if (sk && inet_twsk(sk)->tw_transparent) {
> > + arg.flags = IP_REPLY_ARG_NOSRCCHECK;
> > + }
> > +
>
> Maybe a helper to retrieve the transparant status from a generic socket
> (being full, timewait or request sock) would help.
>
> This could be submitted as a separate patch to ease review.
Makes sense, will do this.
> > oif = sk ? sk->sk_bound_dev_if : 0;
> > + if (!have_full_sk)
> > + sk = NULL;
> > +
>
> I have no idea why you need to set sk to NULL here.
Its a followup error. As sock_net(twsk) is fine this isn't
needed either and I'll remove this part.
> I found this hard to review...
Apologies. Thanks for reviewing despite this, I will try
to address all of your comments.
> It seems you have multiple logical changes ?
> Splitting into at least 2 patches would be nice.
will do,
Thanks Eric.
prev parent reply other threads:[~2015-12-21 18:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-21 16:20 [PATCH -next] tcp: honour SO_BINDTODEVICE for TW_RST case too Florian Westphal
2015-12-21 17:15 ` Eric Dumazet
2015-12-21 18:56 ` Florian Westphal [this message]
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=20151221185620.GB9692@breakpoint.cc \
--to=fw@strlen.de \
--cc=eric.dumazet@gmail.com \
--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).