netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Mike Manning <mmanning@vyatta.att-mail.com>, netdev@vger.kernel.org
Cc: Robert Shearman <rshearma@vyatta.att-mail.com>
Subject: Re: [PATCH net-next v1 1/5] net: allow binding socket in a VRF when there's an unbound socket
Date: Mon, 24 Sep 2018 16:44:05 -0600	[thread overview]
Message-ID: <bfc0ba04-52e1-b742-090a-ada53bb9bd06@gmail.com> (raw)
In-Reply-To: <20180924161326.17167-2-mmanning@vyatta.att-mail.com>

On 9/24/18 10:13 AM, Mike Manning wrote:
> From: Robert Shearman <rshearma@vyatta.att-mail.com>
> 
> There is no easy way currently for applications that want to receive
> packets in the default VRF to be isolated from packets arriving in
> VRFs, which makes using VRF-unaware applications in a VRF-aware system
> a potential security risk.

That comment is not correct.

The point of the l3mdev sysctl's is to prohibit this case. Setting
net.ipv4.{tcp,udp}_l3mdev_accept=0 means that a packet arriving on an
interface enslaved to a VRF can not be received by a global socket.

Setting the l3mdev to 1 allows the default socket to work across VRFs.
If that is not what you want for a given app or a given VRF, then one
option is to add netfilter rules on the VRF device to prohibit it. I
just verified this works for both tcp and udp.

Further, overlapping binds are allowed using SO_REUSEPORT meaning I can
have a server running in the default vrf bound to a port AND a server
running bound to a specific vrf and the same port:

udp    UNCONN     0      0      *%red:12345                 *:*
           users:(("vrf-test",pid=1376,fd=3))
udp    UNCONN     0      0       *:12345                 *:*
        users:(("vrf-test",pid=1375,fd=3))

tcp    LISTEN     0      1      *%red:12345                 *:*
           users:(("vrf-test",pid=1356,fd=3))
tcp    LISTEN     0      1       *:12345                 *:*
        users:(("vrf-test",pid=1352,fd=3))

For packets arriving on an interface enslaved to a VRF the socket lookup
will pick the VRF server over the global one.

  reply	other threads:[~2018-09-25  4:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-24 16:13 [PATCH net-next v1 0/5] vrf: allow simultaneous service instances in default and other VRFs Mike Manning
2018-09-24 16:13 ` [PATCH net-next v1 1/5] net: allow binding socket in a VRF when there's an unbound socket Mike Manning
2018-09-24 22:44   ` David Ahern [this message]
2018-09-25 15:26     ` Mike Manning
2018-09-25 17:16       ` David Ahern
2018-10-01  8:48         ` Mike Manning
2018-09-24 16:13 ` [PATCH net-next v1 2/5] ipv6: allow link-local and multicast packets inside vrf Mike Manning
2018-09-24 23:39   ` David Ahern
2018-09-24 16:13 ` [PATCH net-next v1 3/5] ipv4: Allow sending multicast packets on specific i/f using VRF socket Mike Manning
2018-09-24 23:04   ` David Ahern
2018-09-24 16:13 ` [PATCH net-next v1 4/5] ipv6: do not drop vrf udp multicast packets Mike Manning
2018-09-24 23:21   ` David Ahern
2018-09-24 16:13 ` [PATCH net-next v1 5/5] ipv6: add vrf table handling code for ipv6 mcast Mike Manning
2018-09-24 20:13   ` David Ahern
2018-09-24 23:23   ` 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=bfc0ba04-52e1-b742-090a-ada53bb9bd06@gmail.com \
    --to=dsahern@gmail.com \
    --cc=mmanning@vyatta.att-mail.com \
    --cc=netdev@vger.kernel.org \
    --cc=rshearma@vyatta.att-mail.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).