Skip to content

Commit fd7eafd

Browse files
liuhangbindavem330
authored andcommitted
geneve: fix fill_info when link down
geneve->sock4/6 were added with geneve_open and released with geneve_stop. So when geneve link down, we will not able to show remote address and checksum info after commit 11387fe ("geneve: fix fill_info when using collect_metadata"). Fix this by avoid passing *_REMOTE{,6} for COLLECT_METADATA since they are mutually exclusive, and always show UDP_ZERO_CSUM6_RX info. Fixes: 11387fe ("geneve: fix fill_info when using collect_metadata") Signed-off-by: Hangbin Liu <liuhangbin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 89ad2fa commit fd7eafd

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

drivers/net/geneve.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,6 +1490,7 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
14901490
{
14911491
struct geneve_dev *geneve = netdev_priv(dev);
14921492
struct ip_tunnel_info *info = &geneve->info;
1493+
bool metadata = geneve->collect_md;
14931494
__u8 tmp_vni[3];
14941495
__u32 vni;
14951496

@@ -1498,32 +1499,24 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
14981499
if (nla_put_u32(skb, IFLA_GENEVE_ID, vni))
14991500
goto nla_put_failure;
15001501

1501-
if (rtnl_dereference(geneve->sock4)) {
1502+
if (!metadata && ip_tunnel_info_af(info) == AF_INET) {
15021503
if (nla_put_in_addr(skb, IFLA_GENEVE_REMOTE,
15031504
info->key.u.ipv4.dst))
15041505
goto nla_put_failure;
1505-
15061506
if (nla_put_u8(skb, IFLA_GENEVE_UDP_CSUM,
15071507
!!(info->key.tun_flags & TUNNEL_CSUM)))
15081508
goto nla_put_failure;
15091509

1510-
}
1511-
15121510
#if IS_ENABLED(CONFIG_IPV6)
1513-
if (rtnl_dereference(geneve->sock6)) {
1511+
} else if (!metadata) {
15141512
if (nla_put_in6_addr(skb, IFLA_GENEVE_REMOTE6,
15151513
&info->key.u.ipv6.dst))
15161514
goto nla_put_failure;
1517-
15181515
if (nla_put_u8(skb, IFLA_GENEVE_UDP_ZERO_CSUM6_TX,
15191516
!(info->key.tun_flags & TUNNEL_CSUM)))
15201517
goto nla_put_failure;
1521-
1522-
if (nla_put_u8(skb, IFLA_GENEVE_UDP_ZERO_CSUM6_RX,
1523-
!geneve->use_udp6_rx_checksums))
1524-
goto nla_put_failure;
1525-
}
15261518
#endif
1519+
}
15271520

15281521
if (nla_put_u8(skb, IFLA_GENEVE_TTL, info->key.ttl) ||
15291522
nla_put_u8(skb, IFLA_GENEVE_TOS, info->key.tos) ||
@@ -1533,10 +1526,13 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
15331526
if (nla_put_be16(skb, IFLA_GENEVE_PORT, info->key.tp_dst))
15341527
goto nla_put_failure;
15351528

1536-
if (geneve->collect_md) {
1537-
if (nla_put_flag(skb, IFLA_GENEVE_COLLECT_METADATA))
1529+
if (metadata && nla_put_flag(skb, IFLA_GENEVE_COLLECT_METADATA))
15381530
goto nla_put_failure;
1539-
}
1531+
1532+
if (nla_put_u8(skb, IFLA_GENEVE_UDP_ZERO_CSUM6_RX,
1533+
!geneve->use_udp6_rx_checksums))
1534+
goto nla_put_failure;
1535+
15401536
return 0;
15411537

15421538
nla_put_failure:

0 commit comments

Comments
 (0)