diff --git a/net/core/lwtunnel.c b/net/core/lwtunnel.c index c240c895b319..5d6d8e3d450a 100644 --- a/net/core/lwtunnel.c +++ b/net/core/lwtunnel.c @@ -215,8 +215,12 @@ int lwtunnel_output6(struct sock *sk, struct sk_buff *skb) struct rt6_info *rt = (struct rt6_info *)skb_dst(skb); struct lwtunnel_state *lwtstate = NULL; - if (rt) + if (rt) { lwtstate = rt->rt6i_lwtstate; + skb->dev = rt->dst.dev; + } + + skb->protocol = htons(ETH_P_IPV6); return __lwtunnel_output(sk, skb, lwtstate); } @@ -227,8 +231,12 @@ int lwtunnel_output(struct sock *sk, struct sk_buff *skb) struct rtable *rt = (struct rtable *)skb_dst(skb); struct lwtunnel_state *lwtstate = NULL; - if (rt) + if (rt) { lwtstate = rt->rt_lwtstate; + skb->dev = rt->dst.dev; + } + + skb->protocol = htons(ETH_P_IP); return __lwtunnel_output(sk, skb, lwtstate); } diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 908f7ef2f12a..18fd7c9095c7 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -2022,6 +2022,8 @@ static struct rtable *__mkroute_output(const struct fib_result *res, } rt_set_nexthop(rth, fl4->daddr, res, fnhe, fi, type, 0); + if (lwtunnel_output_redirect(rth->rt_lwtstate)) + rth->dst.output = lwtunnel_output; return rth; }