netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Colitti <lorenzo@google.com>
To: YOSHIFUJI Hideaki <hideaki.yoshifuji@miraclelinux.com>
Cc: David Ahern <dsa@cumulusnetworks.com>, Erik Kline <ek@google.com>,
	David Miller <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	Hannes Frederic Sowa <hannes@stressinduktion.org>
Subject: Re: [PATCH net] net: ipv6: Fix ping to link-local addresses.
Date: Sat, 13 Aug 2016 00:45:16 +0900	[thread overview]
Message-ID: <CAKD1Yr3LNv+hDm0HfxYiGvotiTYab9W-+5R0OUjinF-tdwKy1g@mail.gmail.com> (raw)
In-Reply-To: <ed271d49-e796-ebaa-2e71-35711710fd49@miraclelinux.com>

On Wed, Aug 10, 2016 at 7:44 AM, YOSHIFUJI Hideaki
<hideaki.yoshifuji@miraclelinux.com> wrote:
>
> >> I could see a point of view that says when bound_if is in play sending
> >> to destinations on/via other interfaces--by any mechanism--should
> >> effectively get ENETUNREACH (or something).
> >
> > VRF uses this capability to send on an enslaved interface. ie., socket is bound to VRF device to limit packets to that L3 domain and then uses PKTINFO to force a packet out a particular interface.
>
> We could extend our code to allow enslave devices, maybe.

So something like this, then?

static inline bool inet_check_bound_oif(const struct sock *sk, int oif)
{
        if (!oif || !sk->sk_bound_dev_if || oif == sk->sk_bound_dev_if)
                return true;

#ifdef CONFIG_NET_L3_MASTER_DEV
        return l3mdev_master_ifindex_by_index(sock_net(sk), oif) ==
                sk->sk_bound_dev_if;
#endif

        return false;
}

and then in the various sendmsg functions:

        if (!inet_check_bound_oif(sk, oif))
                return -EINVAL;

  reply	other threads:[~2016-08-12 15:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-08  7:42 [PATCH net] net: ipv6: Fix ping to link-local addresses Lorenzo Colitti
2016-08-08 14:26 ` Hannes Frederic Sowa
2016-08-08 14:45   ` Lorenzo Colitti
2016-08-08 16:22     ` 吉藤英明
2016-08-08 15:27 ` David Ahern
2016-08-08 16:24   ` Lorenzo Colitti
2016-08-08 16:27     ` David Ahern
2016-08-09  0:40       ` Lorenzo Colitti
2016-08-08 21:35 ` David Miller
2016-08-09  1:00   ` Lorenzo Colitti
2016-08-09  5:20     ` David Miller
2016-08-09  7:01       ` Erik Kline
2016-08-09  8:37         ` YOSHIFUJI Hideaki
2016-08-09  9:36           ` Hannes Frederic Sowa
2016-08-09 11:42             ` Lorenzo Colitti
2016-08-09 13:21         ` David Ahern
2016-08-09 22:44           ` YOSHIFUJI Hideaki
2016-08-12 15:45             ` Lorenzo Colitti [this message]
2016-08-12 16:04               ` David Ahern
2016-08-15  7:39               ` YOSHIFUJI Hideaki
2016-08-16 15:21                 ` Lorenzo Colitti
2016-08-16 16:22                   ` 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=CAKD1Yr3LNv+hDm0HfxYiGvotiTYab9W-+5R0OUjinF-tdwKy1g@mail.gmail.com \
    --to=lorenzo@google.com \
    --cc=davem@davemloft.net \
    --cc=dsa@cumulusnetworks.com \
    --cc=ek@google.com \
    --cc=hannes@stressinduktion.org \
    --cc=hideaki.yoshifuji@miraclelinux.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).