]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
geneve: fix fill_info when using collect_metadata
authorEric Garver <e@erig.me>
Tue, 23 May 2017 22:37:27 +0000 (18:37 -0400)
committerDavid S. Miller <davem@davemloft.net>
Thu, 25 May 2017 16:51:16 +0000 (12:51 -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>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/geneve.c

index dec5d563ab19091cdadd422eed9af8268ce5805e..959fd12d2e670dfa52d7d9d11f835e990c82aa7c 100644 (file)
@@ -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) ||