From: Josef Bacik <jbacik@fb.com>
To: Craig Gallek <kraigatgoog@gmail.com>
Cc: David Miller <davem@davemloft.net>,
Hannes Frederic Sowa <hannes@stressinduktion.org>,
Eric Dumazet <eric.dumazet@gmail.com>,
"Tom Herbert" <tom@herbertland.com>,
netdev <netdev@vger.kernel.org>, <kernel-team@fb.com>
Subject: Re: [PATCH 1/6 net-next] inet: collapse ipv4/v6 rcv_saddr_equal functions into one
Date: Thu, 12 Jan 2017 13:13:59 -0500 [thread overview]
Message-ID: <1484244839.3869.0@smtp.office365.com> (raw)
In-Reply-To: <CAEfhGixyDxk6yNCY-FVLAop-VvO0jB1YuOu3i382Y5S40ocwOA@mail.gmail.com>
On Thu, Jan 12, 2017 at 12:41 PM, Craig Gallek <kraigatgoog@gmail.com>
wrote:
> On Wed, Jan 11, 2017 at 3:19 PM, Josef Bacik <jbacik@fb.com> wrote:
>> +int inet_rcv_saddr_equal(const struct sock *sk, const struct sock
>> *sk2,
>> + bool match_wildcard)
>> +{
>> +#if IS_ENABLED(CONFIG_IPV6)
>> + if (sk->sk_family == AF_INET6)
> Still wrapping my head around this, so take it with a grain of salt,
> but it's not obvious to me that sk and sk2 are guaranteed to have the
> same family here (or if it even matters). Especially in the context
> of the next patch which removes the bind_conflict callback... Does
> this need to be an OR check for the family of either socket? Or is it
> safe as-is because the first socket passed to this function is always
> the existing one and the second one is the possible conflict socket?
It's safe as is, all we care is that sk1 is the INET6 socket. In the
compare function we use inet6_rcv_saddr(sk2) which will return NULL if
it isn't INET6 and then the function handles that case appropriately.
This stuff is subtle so it's easy to get confused, I always made sure
to run it on our production boxes to make sure I didn't break something
;). Thanks,
Josef
next prev parent reply other threads:[~2017-01-12 18:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-12 17:41 [PATCH 1/6 net-next] inet: collapse ipv4/v6 rcv_saddr_equal functions into one Craig Gallek
2017-01-12 18:13 ` Josef Bacik [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-01-17 15:51 [PATCH 0/6 net-next][V4] Rework inet_csk_get_port Josef Bacik
2017-01-17 15:51 ` [PATCH 1/6 net-next] inet: collapse ipv4/v6 rcv_saddr_equal functions into one Josef Bacik
2017-01-11 20:06 [PATCH 0/6 net-next][V3] Rework inet_csk_get_port Josef Bacik
2017-01-11 20:19 ` [PATCH 1/6 net-next] inet: collapse ipv4/v6 rcv_saddr_equal functions into one Josef Bacik
2016-12-22 21:26 [PATCH 0/6 net-next][V2] Rework inet_csk_get_port Josef Bacik
2016-12-22 21:26 ` [PATCH 1/6 net-next] inet: collapse ipv4/v6 rcv_saddr_equal functions into one Josef Bacik
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=1484244839.3869.0@smtp.office365.com \
--to=jbacik@fb.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=hannes@stressinduktion.org \
--cc=kernel-team@fb.com \
--cc=kraigatgoog@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=tom@herbertland.com \
/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).