Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Feb 2025 02:50:05 GMT
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 36347cfbf7ac - main - wlanwds: convert getifaddrs() iteration to use the ifa_next pointer
Message-ID:  <202502280250.51S2o5fR024189@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502280250.51S2o5fR024189>