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
This commit is contained in:
Bjoern A. Zeeb 2025-02-19 02:50:11 +00:00
parent ed9712f894
commit 61ce422531
6 changed files with 18 additions and 16 deletions

View file

@ -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>

View file

@ -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

View file

@ -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>

View file

@ -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);
}