All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Manning <mmanning@vyatta.att-mail.com>
To: netdev@vger.kernel.org
Subject: [PATCH net-next v3 6/9] vrf: mark skb for multicast or link-local as enslaved to VRF
Date: Thu,  4 Oct 2018 16:12:11 +0100	[thread overview]
Message-ID: <20181004151214.8522-7-mmanning@vyatta.att-mail.com> (raw)
In-Reply-To: <20181004151214.8522-1-mmanning@vyatta.att-mail.com>

The skb for packets that are multicast or to a link-local address are
not marked as being enslaved to a VRF, if they are received on a socket
bound to the VRF. This is needed for ND and it is preferable for the
kernel not to have to deal with the additional use-cases if ll or mcast
packets are handled as enslaved. However, this does not allow service
instances listening on unbound and bound to VRF sockets to distinguish
the VRF used, if packets are sent as multicast or to a link-local
address. The fix is for the VRF driver to also mark these skb as being
enslaved to the VRF.

Signed-off-by: Mike Manning <mmanning@vyatta.att-mail.com>
---
 drivers/net/vrf.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 69b7227c637e..21ad4b1d7f03 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -981,24 +981,23 @@ static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev,
 				   struct sk_buff *skb)
 {
 	int orig_iif = skb->skb_iif;
-	bool need_strict;
+	bool need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr);
+	bool is_ndisc = ipv6_ndisc_frame(skb);
 
-	/* loopback traffic; do not push through packet taps again.
-	 * Reset pkt_type for upper layers to process skb
+	/* loopback, multicast & non-ND link-local traffic; do not push through
+	 * packet taps again. Reset pkt_type for upper layers to process skb
 	 */
-	if (skb->pkt_type == PACKET_LOOPBACK) {
+	if (skb->pkt_type == PACKET_LOOPBACK || (need_strict && !is_ndisc)) {
 		skb->dev = vrf_dev;
 		skb->skb_iif = vrf_dev->ifindex;
 		IP6CB(skb)->flags |= IP6SKB_L3SLAVE;
-		skb->pkt_type = PACKET_HOST;
+		if (skb->pkt_type == PACKET_LOOPBACK)
+			skb->pkt_type = PACKET_HOST;
 		goto out;
 	}
 
-	/* if packet is NDISC or addressed to multicast or link-local
-	 * then keep the ingress interface
-	 */
-	need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr);
-	if (!ipv6_ndisc_frame(skb) && !need_strict) {
+	/* if packet is NDISC then keep the ingress interface */
+	if (!is_ndisc) {
 		vrf_rx_stats(vrf_dev, skb->len);
 		skb->dev = vrf_dev;
 		skb->skb_iif = vrf_dev->ifindex;
-- 
2.11.0

  parent reply	other threads:[~2018-10-04 22:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-04 15:12 [PATCH net-next v3 0/9] vrf: allow simultaneous service instances in default and other VRFs Mike Manning
2018-10-04 15:12 ` [PATCH net-next v3 1/9] net: allow binding socket in a VRF when there's an unbound socket Mike Manning
2018-10-04 15:12 ` [PATCH net-next v3 2/9] net: ensure unbound stream socket to be chosen when not in a VRF Mike Manning
2018-10-04 15:12 ` [PATCH net-next v3 3/9] net: ensure unbound datagram " Mike Manning
2018-10-04 15:12 ` [PATCH net-next v3 4/9] net: provide a sysctl raw_l3mdev_accept for raw socket lookup with VRFs Mike Manning
2018-10-04 15:12 ` [PATCH net-next v3 5/9] net: fix raw socket lookup device bind matching " Mike Manning
2018-10-04 15:12 ` Mike Manning [this message]
2018-10-04 15:12 ` [PATCH net-next v3 7/9] ipv6: allow ping to link-local address in VRF Mike Manning
2018-10-04 15:12 ` [PATCH net-next v3 8/9] ipv6: handling of multicast packets received " Mike Manning
2018-10-04 15:12 ` [PATCH net-next v3 9/9] ipv6: do not drop vrf udp multicast packets Mike Manning
2018-10-05 21:43 ` [PATCH net-next v3 0/9] vrf: allow simultaneous service instances in default and other VRFs David Miller
2018-10-05 23:49   ` 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=20181004151214.8522-7-mmanning@vyatta.att-mail.com \
    --to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.