This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 7fa4a7f3b4f net/netdev: Fix best prefix in findby
7fa4a7f3b4f is described below
commit 7fa4a7f3b4f18961b1e16e65a11328795dc1c2ad
Author: Jiri Vlasak <[email protected]>
AuthorDate: Thu Jan 8 11:47:46 2026 +0100
net/netdev: Fix best prefix in findby
When comparing with netmask, the best prefix len is netmask.
Signed-off-by: Jiri Vlasak <[email protected]>
---
net/netdev/netdev_findbyaddr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netdev/netdev_findbyaddr.c b/net/netdev/netdev_findbyaddr.c
index 6c76a23d8e6..bef872bcef0 100644
--- a/net/netdev/netdev_findbyaddr.c
+++ b/net/netdev/netdev_findbyaddr.c
@@ -97,7 +97,7 @@ netdev_prefixlen_findby_lipv4addr(in_addr_t lipaddr, FAR
int8_t *prefixlen)
/* Its a match */
bestdev = dev;
- bestpref = 32; /* Regard as best (exact) match */
+ bestpref = (int8_t)net_ipv4_mask2pref(dev->d_netmask);
break;
}
#else