nuttx/net: Expose the net_ipv6addr_maskcmp interface to user-mode calls

This interface needs to be called in the libc library, but the interface is implemented in the kernel, so this interface needs to be exposed

Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
This commit is contained in:
zhangshuai39
2025-02-07 17:01:33 +08:00
committed by Xiang Xiao
parent 6144b51848
commit c44834fb92
4 changed files with 26 additions and 85 deletions
+24 -3
View File
@@ -592,9 +592,30 @@ extern "C"
#endif
#ifdef CONFIG_NET_IPv6
bool net_ipv6addr_maskcmp(const net_ipv6addr_t addr1,
const net_ipv6addr_t addr2,
const net_ipv6addr_t mask);
static inline_function bool net_ipv6addr_maskcmp(const net_ipv6addr_t addr1,
const net_ipv6addr_t addr2,
const net_ipv6addr_t mask)
{
int i;
/* Start from the "bottom" where the addresses will most likely differ */
for (i = 7; i >= 0; i--)
{
/* Same? */
if ((addr1[i] & mask[i]) != (addr2[i] & mask[i]))
{
/* No.. the addresses are different */
return false;
}
}
/* The addresses are the same */
return true;
}
#endif
/****************************************************************************