Skip to content

Commit

Permalink
vrf: Check skb for XFRM_TRANSFORMED flag
Browse files Browse the repository at this point in the history
[ Upstream commit 16b9db1ce34ff00d6c18e82825125cfef0cdfb13 ]

To avoid a loop with qdiscs and xfrms, check if the skb has already gone
through the qdisc attached to the VRF device and then to the xfrm layer.
If so, no need for a second redirect.

Fixes: 193125d ("net: Introduce VRF device driver")
Reported-by: Trev Larock <[email protected]>
Signed-off-by: David Ahern <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
dsahern authored and gregkh committed Apr 29, 2020
1 parent 995908d commit c39723c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/vrf.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,8 @@ static struct sk_buff *vrf_ip6_out(struct net_device *vrf_dev,
if (rt6_need_strict(&ipv6_hdr(skb)->daddr))
return skb;

if (qdisc_tx_is_default(vrf_dev))
if (qdisc_tx_is_default(vrf_dev) ||
IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED)
return vrf_ip6_out_direct(vrf_dev, sk, skb);

return vrf_ip6_out_redirect(vrf_dev, skb);
Expand Down Expand Up @@ -692,7 +693,8 @@ static struct sk_buff *vrf_ip_out(struct net_device *vrf_dev,
ipv4_is_lbcast(ip_hdr(skb)->daddr))
return skb;

if (qdisc_tx_is_default(vrf_dev))
if (qdisc_tx_is_default(vrf_dev) ||
IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED)
return vrf_ip_out_direct(vrf_dev, sk, skb);

return vrf_ip_out_redirect(vrf_dev, skb);
Expand Down

0 comments on commit c39723c

Please sign in to comment.