Commit 603113c5 authored by Antoine Tenart's avatar Antoine Tenart Committed by David S. Miller

vrf: do not push non-ND strict packets with a source LLA through packet taps again

Non-ND strict packets with a source LLA go through the packet taps
again, while non-ND strict packets with other source addresses do not,
and we can see a clone of those packets on the vrf interface (we should
not). This is due to a series of changes:

Commit 6f12fa77[1] made non-ND strict packets not being pushed again
in the packet taps. This changed with commit 205704c6[2] for those
packets having a source LLA, as they need a lookup with the orig_iif.

The issue now is those packets do not skip the 'vrf_ip6_rcv' function to
the end (as the ones without a source LLA) and go through the check to
call packet taps again. This check was changed by commit 6f12fa77[1]
and do not exclude non-strict packets anymore. Packets matching
'need_strict && !is_ndisc && is_ll_src' are now being sent through the
packet taps again. This can be seen by dumping packets on the vrf
interface.

Fix this by having the same code path for all non-ND strict packets and
selectively lookup with the orig_iif for those with a source LLA. This
has the effect to revert to the pre-205704c6[2] condition, which
should also be easier to maintain.

[1] 6f12fa77 ("vrf: mark skb for multicast or link-local as enslaved to VRF")
[2] 205704c6 ("vrf: packets with lladdr src needs dst at input with orig_iif when needs strict")

Fixes: 205704c6 ("vrf: packets with lladdr src needs dst at input with orig_iif when needs strict")
Cc: Stephen Suryaputra <ssuryaextr@gmail.com>
Reported-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarAntoine Tenart <atenart@kernel.org>
Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dda2626b
...@@ -1366,22 +1366,22 @@ static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev, ...@@ -1366,22 +1366,22 @@ static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev,
int orig_iif = skb->skb_iif; int orig_iif = skb->skb_iif;
bool need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr); bool need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr);
bool is_ndisc = ipv6_ndisc_frame(skb); bool is_ndisc = ipv6_ndisc_frame(skb);
bool is_ll_src;
/* loopback, multicast & non-ND link-local traffic; do not push through /* loopback, multicast & non-ND link-local traffic; do not push through
* packet taps again. Reset pkt_type for upper layers to process skb. * packet taps again. Reset pkt_type for upper layers to process skb.
* for packets with lladdr src, however, skip so that the dst can be * For strict packets with a source LLA, determine the dst using the
* determine at input using original ifindex in the case that daddr * original ifindex.
* needs strict
*/ */
is_ll_src = ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL; if (skb->pkt_type == PACKET_LOOPBACK || (need_strict && !is_ndisc)) {
if (skb->pkt_type == PACKET_LOOPBACK ||
(need_strict && !is_ndisc && !is_ll_src)) {
skb->dev = vrf_dev; skb->dev = vrf_dev;
skb->skb_iif = vrf_dev->ifindex; skb->skb_iif = vrf_dev->ifindex;
IP6CB(skb)->flags |= IP6SKB_L3SLAVE; IP6CB(skb)->flags |= IP6SKB_L3SLAVE;
if (skb->pkt_type == PACKET_LOOPBACK) if (skb->pkt_type == PACKET_LOOPBACK)
skb->pkt_type = PACKET_HOST; skb->pkt_type = PACKET_HOST;
else if (ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)
vrf_ip6_input_dst(skb, vrf_dev, orig_iif);
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment