tcp_metrics: fix addr_same() helper
authorEric Dumazet <edumazet@google.com>
Wed, 2 Aug 2023 13:14:55 +0000 (13:14 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 3 Aug 2023 17:58:24 +0000 (10:58 -0700)
commite6638094d7af6c7b9dcca05ad009e79e31b4f670
tree1a31f498654408e4f1ed2928a39890a68500f397
parentb755c25fbcd568821a3bb0e0d5c2daa5fcb00bba
tcp_metrics: fix addr_same() helper

Because v4 and v6 families use separate inetpeer trees (respectively
net->ipv4.peers and net->ipv6.peers), inetpeer_addr_cmp(a, b) assumes
a & b share the same family.

tcp_metrics use a common hash table, where entries can have different
families.

We must therefore make sure to not call inetpeer_addr_cmp()
if the families do not match.

Fixes: d39d14ffa24c ("net: Add helper function to compare inetpeer addresses")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://lore.kernel.org/r/20230802131500.1478140-2-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/tcp_metrics.c