net: Add helper function to compare inetpeer addresses

tcp_metrics and inetpeer both have functions to compare inetpeer
addresses. Consolidate into 1 version.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David Ahern
2015-08-27 16:07:01 -07:00
committed by David S. Miller
parent 3abef286cf
commit d39d14ffa2
3 changed files with 19 additions and 23 deletions

View File

@@ -81,11 +81,7 @@ static void tcp_metric_set(struct tcp_metrics_block *tm,
static bool addr_same(const struct inetpeer_addr *a,
const struct inetpeer_addr *b)
{
if (a->family != b->family)
return false;
if (a->family == AF_INET)
return a->addr.a4 == b->addr.a4;
return ipv6_addr_equal(&a->addr.in6, &b->addr.in6);
return inetpeer_addr_cmp(a, b) == 0;
}
struct tcpm_hash_bucket {