From: David Ahern <dsahern@gmail.com>
To: Mike Manning <mmanning@vyatta.att-mail.com>, netdev@vger.kernel.org
Cc: Duncan Eastoe <deastoe@vyatta.att-mail.com>
Subject: Re: [PATCH net-next v2 06/10] net: IP[V6]_MULTICAST_IF constraint on unbound socket if VRFs present
Date: Tue, 2 Oct 2018 13:59:26 -0600 [thread overview]
Message-ID: <002ace7c-3071-cca5-80ff-41607060248d@gmail.com> (raw)
In-Reply-To: <20181001084320.32453-7-mmanning@vyatta.att-mail.com>
On 10/1/18 2:43 AM, Mike Manning wrote:
> From: Duncan Eastoe <deastoe@vyatta.att-mail.com>
>
> If setsockopt(IP_MULTICAST_IF) or setsockopt(IPV6_MULTICAST_IF) is
> called on a socket which is not bound to a VRF then we should ensure
> that the output device chosen is also not bound to a VRF master.
Why does it matter? An app can set IP_MULTICAST_IF on the socket in the
same way it can set the device bind.
This breaks existing apps.
>
> This avoids inadvertently sending traffic out of the wrong interface.
> This can be particularly problematic for IP_MULTICAST_IF since the
> interface lookup can be performed by address as well as ifindex. If
> there are interfaces with the same address, one unbound and one bound
> to a VRF, then the interface bound to the VRF may be chosen when the
> sockopt is called on an unbound socket.
>
> Signed-off-by: Duncan Eastoe <deastoe@vyatta.att-mail.com>
> Signed-off-by: Mike Manning <mmanning@vyatta.att-mail.com>
> ---
> net/ipv4/ip_sockglue.c | 3 +++
> net/ipv6/ipv6_sockglue.c | 3 +++
> 2 files changed, 6 insertions(+)
>
> diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
> index c0fe5ad996f2..026971314c43 100644
> --- a/net/ipv4/ip_sockglue.c
> +++ b/net/ipv4/ip_sockglue.c
> @@ -892,6 +892,9 @@ static int do_ip_setsockopt(struct sock *sk, int level,
> dev_put(dev);
>
> err = -EINVAL;
> + if (!sk->sk_bound_dev_if && midx)
> + break;
> +
> if (sk->sk_bound_dev_if &&
> mreq.imr_ifindex != sk->sk_bound_dev_if &&
> (!midx || midx != sk->sk_bound_dev_if))
> diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
> index c0cac9cc3a28..7dfbc797b130 100644
> --- a/net/ipv6/ipv6_sockglue.c
> +++ b/net/ipv6/ipv6_sockglue.c
> @@ -626,6 +626,9 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
>
> rcu_read_unlock();
>
> + if (!sk->sk_bound_dev_if && midx)
> + goto e_inval;
> +
> if (sk->sk_bound_dev_if &&
> sk->sk_bound_dev_if != val &&
> (!midx || midx != sk->sk_bound_dev_if))
>
next prev parent reply other threads:[~2018-10-03 2:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-01 8:43 [PATCH net-next v2 00/10] vrf: allow simultaneous service instances in default and other VRFs Mike Manning
2018-10-01 8:43 ` [PATCH net-next v2 01/10] net: allow binding socket in a VRF when there's an unbound socket Mike Manning
2018-10-02 19:39 ` David Ahern
2018-10-01 8:43 ` [PATCH net-next v2 02/10] net: ensure unbound stream socket to be chosen when not in a VRF Mike Manning
2018-10-01 8:43 ` [PATCH net-next v2 03/10] net: ensure unbound datagram " Mike Manning
2018-10-01 8:43 ` [PATCH net-next v2 04/10] net: provide a sysctl raw_l3mdev_accept for raw socket lookup with VRFs Mike Manning
2018-10-02 19:39 ` David Ahern
2018-10-01 8:43 ` [PATCH net-next v2 05/10] net: fix raw socket lookup device bind matching " Mike Manning
2018-10-01 8:43 ` [PATCH net-next v2 06/10] net: IP[V6]_MULTICAST_IF constraint on unbound socket if VRFs present Mike Manning
2018-10-02 19:59 ` David Ahern [this message]
2018-10-01 8:43 ` [PATCH net-next v2 07/10] vrf: mark skb for multicast or link-local as enslaved to VRF Mike Manning
2018-10-01 8:43 ` [PATCH net-next v2 08/10] ipv6: allow ping to link-local address in VRF Mike Manning
2018-10-01 8:43 ` [PATCH net-next v2 09/10] ipv6: handling of multicast packets received " Mike Manning
2018-10-01 8:43 ` [PATCH net-next v2 10/10] ipv6: do not drop vrf udp multicast packets Mike Manning
2018-10-02 20:16 ` [PATCH net-next v2 00/10] vrf: allow simultaneous service instances in default and other VRFs David Ahern
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=002ace7c-3071-cca5-80ff-41607060248d@gmail.com \
--to=dsahern@gmail.com \
--cc=deastoe@vyatta.att-mail.com \
--cc=mmanning@vyatta.att-mail.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).