netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] ip_gre: Support lwtunnel for none-tunnel-dst gre port
@ 2018-12-27  9:31 wenxu
  2019-01-10 15:19 ` wenxu
  0 siblings, 1 reply; 3+ messages in thread
From: wenxu @ 2018-12-27  9:31 UTC (permalink / raw)
  To: netdev

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

Signed-off-by: wenxu <wenxu@ucloud.cn>
---
 net/ipv4/ip_gre.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

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);
 }
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] ip_gre: Support lwtunnel for none-tunnel-dst gre port
  2018-12-27  9:31 [PATCH net-next] ip_gre: Support lwtunnel for none-tunnel-dst gre port wenxu
@ 2019-01-10 15:19 ` wenxu
  2019-01-10 15:29   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: wenxu @ 2019-01-10 15:19 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

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
>
>  

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] ip_gre: Support lwtunnel for none-tunnel-dst gre port
  2019-01-10 15:19 ` wenxu
@ 2019-01-10 15:29   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2019-01-10 15:29 UTC (permalink / raw)
  To: wenxu; +Cc: netdev

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-10 15:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-27  9:31 [PATCH net-next] ip_gre: Support lwtunnel for none-tunnel-dst gre port wenxu
2019-01-10 15:19 ` wenxu
2019-01-10 15:29   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).