--- zzzz-none-000/linux-4.4.60/net/ipv4/ip_tunnel_core.c 2017-04-08 07:53:53.000000000 +0000 +++ scorpion-1750e-727/linux-4.4.60/net/ipv4/ip_tunnel_core.c 2021-02-04 17:41:59.000000000 +0000 @@ -56,6 +56,10 @@ struct net *net = dev_net(rt->dst.dev); struct iphdr *iph; int err; + int skb_iif; + + /* Save input interface index */ + skb_iif = skb->skb_iif; skb_scrub_packet(skb, xnet); @@ -79,7 +83,11 @@ iph->ttl = ttl; __ip_select_ident(net, iph, skb_shinfo(skb)->gso_segs ?: 1); + if (proto == IPPROTO_IPV6 || proto == IPPROTO_GRE) + skb->skb_iif = skb_iif; + err = ip_local_out(net, sk, skb); + if (unlikely(net_xmit_eval(err))) pkt_len = 0; return pkt_len;