git: 36347cfbf7ac - main - wlanwds: convert getifaddrs() iteration to use the ifa_next pointer
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 28 Feb 2025 02:50:05 UTC
The branch main has been updated by adrian:
URL: https://cgit.FreeBSD.org/src/commit/?id=36347cfbf7ac3d1db79fa369266b1cc391daf511
commit 36347cfbf7ac3d1db79fa369266b1cc391daf511
Author: Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2025-02-27 02:18:23 +0000
Commit: Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2025-02-28 02:49:49 +0000
wlanwds: convert getifaddrs() iteration to use the ifa_next pointer
I don't know what I was thinking in 2017 when I wrote this, but
it's very wrong.
Use ifa->ifa_next to iterate, not the array index / pointer arithmetic.
Differential Revision: https://reviews.freebsd.org/D49148
---
tools/tools/net80211/wlanwds/wlanwds.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/tools/net80211/wlanwds/wlanwds.c b/tools/tools/net80211/wlanwds/wlanwds.c
index a9ca89e4d5b1..193a9b0a60d4 100644
--- a/tools/tools/net80211/wlanwds/wlanwds.c
+++ b/tools/tools/net80211/wlanwds/wlanwds.c
@@ -283,7 +283,7 @@ getlladdr(const char *ifname, uint8_t macaddr[ETHER_ADDR_LEN])
}
/* Look for a matching interface */
- for (ifa = ifap; ifa != NULL; ifa++) {
+ for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
if (strcmp(ifname, ifa->ifa_name) != 0)
continue;