netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] ip_gre: Make none-tun-dst gre tunnel keep tunnel info
@ 2019-11-19  7:08 wenxu
  2019-11-20  0:39 ` David Miller
  0 siblings, 1 reply; 30+ messages in thread
From: wenxu @ 2019-11-19  7:08 UTC (permalink / raw)
  To: pablo, davem; +Cc: netdev

From: wenxu <wenxu@ucloud.cn>

Currently only collect_md gre tunnel keep tunnel info.
But the nono-tun-dst gre tunnel already can send packte through
lwtunnel.

For non-tun-dst gre tunnel should keep the tunnel info to make
the arp response can send success through the tunnel_info in
iptunnel_metadata_reply.

The following is the test script:

ip netns add cl
ip l add dev vethc type veth peer name eth0 netns cl

ifconfig vethc 172.168.0.7/24 up
ip l add dev tun1000 type gretap key 1000

ip link add user1000 type vrf table 1
ip l set user1000 up
ip l set dev tun1000 master user1000
ifconfig tun1000 10.0.1.1/24 up

ip netns exec cl ifconfig eth0 172.168.0.17/24 up
ip netns exec cl ip l add dev tun type gretap local 172.168.0.17 remote 172.168.0.7 key 1000
ip netns exec cl ifconfig tun 10.0.1.7/24 up
ip r r 10.0.1.7 encap ip id 1000 dst 172.168.0.17 key dev tun1000 table 1

With this patch
ip netns exec cl ping 10.0.1.1 can success

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

diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 10636fb..572b630 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -340,6 +340,8 @@ static int __ipgre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
 				  iph->saddr, iph->daddr, tpi->key);
 
 	if (tunnel) {
+		const struct iphdr *tnl_params;
+
 		if (__iptunnel_pull_header(skb, hdr_len, tpi->proto,
 					   raw_proto, false) < 0)
 			goto drop;
@@ -348,7 +350,9 @@ static int __ipgre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
 			skb_pop_mac_header(skb);
 		else
 			skb_reset_mac_header(skb);
-		if (tunnel->collect_md) {
+
+		tnl_params = &tunnel->parms.iph;
+		if (tunnel->collect_md || tnl_params->daddr == 0) {
 			__be16 flags;
 			__be64 tun_id;
 
-- 
1.8.3.1


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

end of thread, other threads:[~2019-12-10  6:53 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19  7:08 [PATCH net-next] ip_gre: Make none-tun-dst gre tunnel keep tunnel info wenxu
2019-11-20  0:39 ` David Miller
2019-11-21  7:30   ` Question about flow table offload in mlx5e wenxu
2019-11-21  7:42     ` Paul Blakey
2019-11-21  8:28       ` wenxu
2019-11-21 11:39         ` Paul Blakey
2019-11-21 11:40           ` Paul Blakey
2019-11-21 12:35           ` wenxu
2019-11-21 13:05             ` Paul Blakey
2019-11-21 13:39               ` wenxu
2019-11-22  6:12               ` wenxu
     [not found]               ` <64285654-bc9a-c76e-5875-dc6e434dc4d4@ucloud.cn>
2019-11-24  8:46                 ` Paul Blakey
2019-11-24 11:14                   ` wenxu
2019-11-26  8:18                   ` wenxu
     [not found]                     ` <84874b42-c525-2149-539d-e7510d15f6a6@mellanox.com>
2019-11-27 12:16                       ` wenxu
2019-11-27 12:16                       ` wenxu
2019-11-27 13:11                         ` Paul Blakey
2019-11-27 13:20                           ` Paul Blakey
2019-11-27 13:45                             ` wenxu
2019-12-02  3:37                               ` wenxu
2019-12-05 15:17                                 ` Paul Blakey
2019-12-08  9:39                                   ` Paul Blakey
2019-12-09  3:18                                     ` wenxu
2019-12-09  7:48                                       ` Paul Blakey
2019-12-09 10:48                                         ` wenxu
2019-12-10  6:53                                         ` wenxu
2019-11-28  5:03                       ` Bad performance for VF outgoing in offloaded mode wenxu
2019-12-04 13:50                         ` Roi Dayan
2019-12-04 14:32                           ` wenxu
2019-12-05  3:41                           ` wenxu

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