[PATCH mptcp-next v5 5/5] mptcp: use ipv6_addr_equal in addresses_equal

Geliang Tang posted 5 patches 3 months, 2 weeks ago
[PATCH mptcp-next v5 5/5] mptcp: use ipv6_addr_equal in addresses_equal
Posted by Geliang Tang 3 months, 2 weeks ago
From: Geliang Tang <tanggeliang@kylinos.cn>

Use ipv6_addr_equal() to check whether two IPv6 addresses are equal in
mptcp_addresses_equal() is more appropriate than using ipv6_addr_cmp().

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 net/mptcp/pm_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index 1462dc7e886d..6461aa742385 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -64,7 +64,7 @@ bool mptcp_addresses_equal(const struct mptcp_addr_info *a,
 			addr_equals = a->addr.s_addr == b->addr.s_addr;
 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
 		else
-			addr_equals = !ipv6_addr_cmp(&a->addr6, &b->addr6);
+			addr_equals = ipv6_addr_equal(&a->addr6, &b->addr6);
 	} else if (a->family == AF_INET) {
 		if (ipv6_addr_v4mapped(&b->addr6))
 			addr_equals = a->addr.s_addr == b->addr6.s6_addr32[3];
-- 
2.43.0
Re: [PATCH mptcp-next v5 5/5] mptcp: use ipv6_addr_equal in addresses_equal
Posted by Matthieu Baerts 3 months, 2 weeks ago
Hi Geliang,

On 24/01/2025 08:10, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> Use ipv6_addr_equal() to check whether two IPv6 addresses are equal in
> mptcp_addresses_equal() is more appropriate than using ipv6_addr_cmp().
> 
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
>  net/mptcp/pm_netlink.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
> index 1462dc7e886d..6461aa742385 100644
> --- a/net/mptcp/pm_netlink.c
> +++ b/net/mptcp/pm_netlink.c
> @@ -64,7 +64,7 @@ bool mptcp_addresses_equal(const struct mptcp_addr_info *a,
>  			addr_equals = a->addr.s_addr == b->addr.s_addr;
>  #if IS_ENABLED(CONFIG_MPTCP_IPV6)
>  		else
> -			addr_equals = !ipv6_addr_cmp(&a->addr6, &b->addr6);
> +			addr_equals = ipv6_addr_equal(&a->addr6, &b->addr6);

Good idea, that looks more logical!

Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.