Skip to contentSkip to conversation

geneve: fix fill_info when using collect_metadata

PATCH In review Eric Garver 3 participants 4 messages May 23, 2017 – May 25, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 geneve: fix fill_info when using collect_metadata

Since 9b4437a5b870 ("geneve: Unify LWT and netdev handling.") fill_info does not return UDP_ZERO_CSUM6_RX when using COLLECT_METADATA. This is because it uses ip_tunnel_info_af() with the device level info, which is not valid for COLLECT_METADATA.

Fix by checking for the presence of the actual sockets.

Fixes 9b4437a5b870 ("geneve: Unify LWT and netdev handling.")
---
 drivers/net/geneve.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/geneve.c +5 -3
index dec5d563ab19..959fd12d2e67 100644
@@ -1293,7 +1293,7 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
 	if (nla_put_u32(skb, IFLA_GENEVE_ID, vni))
 		goto nla_put_failure;
 
-	if (ip_tunnel_info_af(info) == AF_INET) {
+	if (rtnl_dereference(geneve->sock4)) {
 		if (nla_put_in_addr(skb, IFLA_GENEVE_REMOTE,
 				    info->key.u.ipv4.dst))
 			goto nla_put_failure;
@@ -1302,8 +1302,10 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
 			       !!(info->key.tun_flags & TUNNEL_CSUM)))
 			goto nla_put_failure;
 
+	}
+
 #if IS_ENABLED(CONFIG_IPV6)
-	} else {
+	if (rtnl_dereference(geneve->sock6)) {
 		if (nla_put_in6_addr(skb, IFLA_GENEVE_REMOTE6,
 				     &info->key.u.ipv6.dst))
 			goto nla_put_failure;
@@ -1315,8 +1317,8 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
 		if (nla_put_u8(skb, IFLA_GENEVE_UDP_ZERO_CSUM6_RX,
 			       !geneve->use_udp6_rx_checksums))
 			goto nla_put_failure;
-#endif
 	}
+#endif
 
 	if (nla_put_u8(skb, IFLA_GENEVE_TTL, info->key.ttl) ||
 	    nla_put_u8(skb, IFLA_GENEVE_TOS, info->key.tos) ||
Signature · 1 line
2.12.0
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Eric Garver

Since 9b4437a5b870 ("geneve: Unify LWT and netdev handling.") fill_info does not return UDP_ZERO_CSUM6_RX when using COLLECT_METADATA. This is because it uses ip_tunnel_info_af() with the device level info, which is not valid for COLLECT_METADATA.

Fix by checking for the presence of the actual sockets.

Fixes 9b4437a5b870 ("geneve: Unify LWT and netdev handling.")

Thanks for the patch.

I noticed that the MTU and encal_len calculation in geneve_configure() also needs to be fixed for collect metadata case. Can you send patch to fix it?

#2 lore raw
Quoted 10 lines · Pravin Shelar
Quoted 9 lines · Eric Garver

Since 9b4437a5b870 ("geneve: Unify LWT and netdev handling.") fill_info does not return UDP_ZERO_CSUM6_RX when using COLLECT_METADATA. This is because it uses ip_tunnel_info_af() with the device level info, which is not valid for COLLECT_METADATA.

Fix by checking for the presence of the actual sockets.

Fixes 9b4437a5b870 ("geneve: Unify LWT and netdev handling.")
Quoted 8 lines

Thanks for the patch.

I noticed that the MTU and encal_len calculation in geneve_configure() also needs to be fixed for collect metadata case. Can you send patch to fix it?

Ah, yes. I'll take a look at those as well.

Eric.

maintainer
#3 lore raw
In reply to Eric Garver

From: Eric Garver <[email protected]>
Date: Tue, 23 May 2017 18:37:27 -0400

Quoted 9 lines

Since 9b4437a5b870 ("geneve: Unify LWT and netdev handling.") fill_info does not return UDP_ZERO_CSUM6_RX when using COLLECT_METADATA. This is because it uses ip_tunnel_info_af() with the device level info, which is not valid for COLLECT_METADATA.

Fix by checking for the presence of the actual sockets.

Fixes 9b4437a5b870 ("geneve: Unify LWT and netdev handling.")

Please target bug fixes at 'net' not 'net-next' unless the bug only exists in 'net-next'.

I've applied this to 'net' and queued it up for -stable.