diff mbox

[net-next] geneve: fix fill_info when using collect_metadata

Message ID 20170523223727.15307-1-e@erig.me
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Garver May 23, 2017, 10:37 p.m. UTC
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.")
Signed-off-by: Eric Garver <e@erig.me>
---
 drivers/net/geneve.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Pravin Shelar May 24, 2017, 7:20 p.m. UTC | #1
On Tue, May 23, 2017 at 3:37 PM, Eric Garver <e@erig.me> wrote:
> 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.")
> Signed-off-by: Eric Garver <e@erig.me>
Thanks for the patch.

Acked-by: Pravin B Shelar <pshelar@ovn.org>


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?
Eric Garver May 24, 2017, 7:58 p.m. UTC | #2
On Wed, May 24, 2017 at 12:20:36PM -0700, Pravin Shelar wrote:
> On Tue, May 23, 2017 at 3:37 PM, Eric Garver <e@erig.me> wrote:
> > 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.")
> > Signed-off-by: Eric Garver <e@erig.me>
> Thanks for the patch.
> 
> Acked-by: Pravin B Shelar <pshelar@ovn.org>
> 
> 
> 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.
David Miller May 25, 2017, 4:51 p.m. UTC | #3
From: Eric Garver <e@erig.me>
Date: Tue, 23 May 2017 18:37:27 -0400

> 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.")
> Signed-off-by: Eric Garver <e@erig.me>

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.
diff mbox

Patch

diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index dec5d563ab19..959fd12d2e67 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -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) ||