The branch main has been updated by bz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=61ce422531805307d413bf04c9ad1aabd7f3a879

commit 61ce422531805307d413bf04c9ad1aabd7f3a879
Author:     Bjoern A. Zeeb <b...@freebsd.org>
AuthorDate: 2025-02-19 02:50:11 +0000
Commit:     Bjoern A. Zeeb <b...@freebsd.org>
CommitDate: 2025-02-19 02:56:59 +0000

    wlanstats: move from tools to usr.sbin
    
    wlanstats is an incredible tool to get a quick overview of state
    of affairs of wireless by looking at the counters.
    And it makes it simple.
    
    Having landed the LinuxKPI HW_CRYPTO bits I was asked by users
    what to check and I realised the answer is in wlanstats.
    
    It is annoying even as a developer to manually build it for each
    installation but given it's also useful to users and support
    make it available with the general installation.
    Probably very long overdue.
    
    Adjust the Makefile and make build again on main.
    Hook it up to the build conditional on MK_WIRELESS.
    
    Discussed with: adrian
    Sponsored by:   The FreeBSD Foundation
    TODO:           man page
    MFC after:      3 days
---
 tools/tools/net80211/wlanstats/Makefile                  | 13 -------------
 usr.sbin/Makefile                                        |  1 +
 usr.sbin/wlanstats/Makefile                              | 14 ++++++++++++++
 {tools/tools/net80211 => usr.sbin}/wlanstats/main.c      |  0
 {tools/tools/net80211 => usr.sbin}/wlanstats/wlanstats.c |  6 +++---
 {tools/tools/net80211 => usr.sbin}/wlanstats/wlanstats.h |  0
 6 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/tools/tools/net80211/wlanstats/Makefile 
b/tools/tools/net80211/wlanstats/Makefile
deleted file mode 100644
index f3b6f718d44e..000000000000
--- a/tools/tools/net80211/wlanstats/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-.include <bsd.compiler.mk>
-
-PROG=  wlanstats
-BINDIR=        /usr/local/bin
-MAN=
-LIBADD=        bsdstat
-CFLAGS+=-I${.CURDIR}/../../../../lib/libbsdstat/
-
-SRCS=  wlanstats.c main.c
-
-CFLAGS.clang+= -fbracket-depth=512 -Wno-cast-align
-
-.include <bsd.prog.mk>
diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile
index 3904594bb2d9..a35c34ee23fc 100644
--- a/usr.sbin/Makefile
+++ b/usr.sbin/Makefile
@@ -207,6 +207,7 @@ SUBDIR.${MK_UTMPX}+=        ac
 SUBDIR.${MK_UTMPX}+=   lastlogin
 SUBDIR.${MK_UTMPX}+=   utx
 SUBDIR.${MK_WIRELESS}+=        wlandebug
+SUBDIR.${MK_WIRELESS}+=        wlanstats
 SUBDIR.${MK_WIRELESS}+=        wpa
 
 SUBDIR.${MK_TESTS}+=   tests
diff --git a/usr.sbin/wlanstats/Makefile b/usr.sbin/wlanstats/Makefile
new file mode 100644
index 000000000000..d6d29dcc57ad
--- /dev/null
+++ b/usr.sbin/wlanstats/Makefile
@@ -0,0 +1,14 @@
+.include <bsd.compiler.mk>
+
+PROG=  wlanstats
+MAN=
+
+CFLAGS=        -I${SRCTOP}/lib/libbsdstat
+LIBADD=        bsdstat
+
+SRCS=  main.c \
+       wlanstats.c
+
+CFLAGS.clang+= -fbracket-depth=512
+
+.include <bsd.prog.mk>
diff --git a/tools/tools/net80211/wlanstats/main.c b/usr.sbin/wlanstats/main.c
similarity index 100%
rename from tools/tools/net80211/wlanstats/main.c
rename to usr.sbin/wlanstats/main.c
diff --git a/tools/tools/net80211/wlanstats/wlanstats.c 
b/usr.sbin/wlanstats/wlanstats.c
similarity index 99%
rename from tools/tools/net80211/wlanstats/wlanstats.c
rename to usr.sbin/wlanstats/wlanstats.c
index 74b1e7ffc989..8795333ccb17 100644
--- a/tools/tools/net80211/wlanstats/wlanstats.c
+++ b/usr.sbin/wlanstats/wlanstats.c
@@ -50,7 +50,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "../../../../sys/net80211/ieee80211_ioctl.h"
+#include "../../sys/net80211/ieee80211_ioctl.h"
 
 #include "wlanstats.h"
 
@@ -460,8 +460,8 @@ getlladdr(struct wlanstatfoo_p *wf)
        if (p == NULL)
                errx(1, "did not find link layer address for interface %s",
                        wf->ifr.ifr_name);
-       sdl = (const struct sockaddr_dl *) p->ifa_addr;
-       IEEE80211_ADDR_COPY(wf->mac, CLLADDR(sdl));
+       sdl = (const struct sockaddr_dl *)(const void *)p->ifa_addr;
+       IEEE80211_ADDR_COPY(wf->mac, sdl->sdl_data + sdl->sdl_nlen);
        freeifaddrs(ifp);
 }
 
diff --git a/tools/tools/net80211/wlanstats/wlanstats.h 
b/usr.sbin/wlanstats/wlanstats.h
similarity index 100%
rename from tools/tools/net80211/wlanstats/wlanstats.h
rename to usr.sbin/wlanstats/wlanstats.h

Reply via email to