Skip to content

Commit 6f12fa7

Browse files
Mike Manningdavem330
authored andcommitted
vrf: mark skb for multicast or link-local as enslaved to VRF
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 <[email protected]> Reviewed-by: David Ahern <[email protected]> Tested-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7055420 commit 6f12fa7

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

drivers/net/vrf.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -981,24 +981,23 @@ static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev,
981981
struct sk_buff *skb)
982982
{
983983
int orig_iif = skb->skb_iif;
984-
bool need_strict;
984+
bool need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr);
985+
bool is_ndisc = ipv6_ndisc_frame(skb);
985986

986-
/* loopback traffic; do not push through packet taps again.
987-
* Reset pkt_type for upper layers to process skb
987+
/* loopback, multicast & non-ND link-local traffic; do not push through
988+
* packet taps again. Reset pkt_type for upper layers to process skb
988989
*/
989-
if (skb->pkt_type == PACKET_LOOPBACK) {
990+
if (skb->pkt_type == PACKET_LOOPBACK || (need_strict && !is_ndisc)) {
990991
skb->dev = vrf_dev;
991992
skb->skb_iif = vrf_dev->ifindex;
992993
IP6CB(skb)->flags |= IP6SKB_L3SLAVE;
993-
skb->pkt_type = PACKET_HOST;
994+
if (skb->pkt_type == PACKET_LOOPBACK)
995+
skb->pkt_type = PACKET_HOST;
994996
goto out;
995997
}
996998

997-
/* if packet is NDISC or addressed to multicast or link-local
998-
* then keep the ingress interface
999-
*/
1000-
need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr);
1001-
if (!ipv6_ndisc_frame(skb) && !need_strict) {
999+
/* if packet is NDISC then keep the ingress interface */
1000+
if (!is_ndisc) {
10021001
vrf_rx_stats(vrf_dev, skb->len);
10031002
skb->dev = vrf_dev;
10041003
skb->skb_iif = vrf_dev->ifindex;

0 commit comments

Comments
 (0)