summaryrefslogtreecommitdiff
path: root/net/ipv6
diff options
context:
space:
mode:
authorQing Deng <i@moy.cat>2022-01-23 09:00:00 +0300
committerDavid S. Miller <davem@davemloft.net>2022-01-25 13:49:25 +0300
commitc1f55c5e0482e095b1d0d6721e4e56fcb44fe001 (patch)
treea0f4c4cf086d34f80de0f6f8d7fdb485aea23d0a /net/ipv6
parent53243d412ec59e2937f1e25beaa0fdca3259227f (diff)
downloadlinux-c1f55c5e0482e095b1d0d6721e4e56fcb44fe001.tar.xz
ip6_tunnel: allow routing IPv4 traffic in NBMA mode
Since IPv4 routes support IPv6 gateways now, we can route IPv4 traffic in NBMA tunnels. Signed-off-by: Qing Deng <i@moy.cat> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/ip6_tunnel.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 97ade833f58c..b47ffc81f9e5 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1121,6 +1121,11 @@ int ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, __u8 dsfield,
memcpy(&fl6->daddr, addr6, sizeof(fl6->daddr));
neigh_release(neigh);
+ } else if (skb->protocol == htons(ETH_P_IP)) {
+ struct rtable *rt = skb_rtable(skb);
+
+ if (rt->rt_gw_family == AF_INET6)
+ memcpy(&fl6->daddr, &rt->rt_gw6, sizeof(fl6->daddr));
}
} else if (t->parms.proto != 0 && !(t->parms.flags &
(IP6_TNL_F_USE_ORIG_TCLASS |