Message ID | 1545903065-18580-1-git-send-email-wenxu@ucloud.cn |
---|---|
State | Deferred, archived |
Delegated to: | David Miller |
Headers | show |
Series | [net-next] ip_gre: Support lwtunnel for none-tunnel-dst gre port | expand |
Hi David, This patch status shows Deferred. Should I resubmit it? wenxu On 2018/12/27 下午5:31, wenxu@ucloud.cn wrote: > From: wenxu <wenxu@ucloud.cn> > > ip l add dev tun type gretap key 1000 > ip a a dev tun 10.0.0.1/24 > > Packets with tun-id 1000 can be recived by tun dev. But packet can't > be sent through dev tun for non-tunnel-dst > > With this patch: tunnel-dst can be get through lwtunnel like beflow: > ip r a 10.0.0.7 encap ip id 1000 dst 172.168.0.11 key dev tun > >
From: wenxu <wenxu@ucloud.cn> Date: Thu, 10 Jan 2019 23:19:26 +0800 > This patch status shows Deferred. Should I resubmit it? Where did I say that the net-next is OPEN? It isn't, therefore you should not.
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index c7a7bd5..69c2a1d 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -450,6 +450,24 @@ static void __gre_xmit(struct sk_buff *skb, struct net_device *dev, tunnel->parms.o_flags, proto, tunnel->parms.o_key, htonl(tunnel->o_seqno)); + if (!tnl_params->daddr) { + struct ip_tunnel_info *tun_info; + + tun_info = skb_tunnel_info(skb); + if (tun_info && (tun_info->mode & IP_TUNNEL_INFO_TX) && + ip_tunnel_info_af(tun_info) == AF_INET && + tun_info->key.u.ipv4.dst) { + struct iphdr tnl_params_info; + + memcpy(&tnl_params_info, tnl_params, + sizeof(tnl_params_info)); + tnl_params_info.daddr = tun_info->key.u.ipv4.dst; + + return ip_tunnel_xmit(skb, dev, &tnl_params_info, + tnl_params_info.protocol); + } + } + ip_tunnel_xmit(skb, dev, tnl_params, tnl_params->protocol); }