[wlanstats] Fix warnings-as-errors on gcc-6.4 on mips

* use CLLADDR() to not try deconsting a const
* Unsigned where they should be
* static where it should be

Tested:

* freebsd/mips32, using gcc-6.4
This commit is contained in:
Adrian Chadd 2020-12-28 17:03:11 -08:00
parent ee938b2033
commit ff7c2c5a3b
2 changed files with 10 additions and 8 deletions

View file

@ -70,7 +70,7 @@ static struct {
static const char *
getfmt(const char *tag)
{
int i;
unsigned int i;
for (i = 0; i < nitems(tags); i++)
if (strcasecmp(tags[i].tag, tag) == 0)
return tags[i].fmt;
@ -156,8 +156,10 @@ print_sta_stats(FILE *fd, const u_int8_t macaddr[IEEE80211_ADDR_LEN])
}
#endif
void
usage(void) {
static void
usage(void)
{
printf("wlanstats: [-ah] [-i ifname] [-l] [-m station MAC address] [-o fmt] [interval]\n");
}

View file

@ -463,7 +463,7 @@ getlladdr(struct wlanstatfoo_p *wf)
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, LLADDR(sdl));
IEEE80211_ADDR_COPY(wf->mac, CLLADDR(sdl));
freeifaddrs(ifp);
}
@ -561,8 +561,8 @@ wlan_update_tot(struct bsdstat *sf)
wf->ntotal = wf->ncur;
}
void
setreason(char b[], size_t bs, int v)
static void
setreason(char b[], size_t bs, unsigned int v)
{
static const char *reasons[] = {
[IEEE80211_REASON_UNSPECIFIED] = "unspecified",
@ -595,8 +595,8 @@ setreason(char b[], size_t bs, int v)
snprintf(b, bs, "%u", v);
}
void
setstatus(char b[], size_t bs, int v)
static void
setstatus(char b[], size_t bs, unsigned int v)
{
static const char *status[] = {
[IEEE80211_STATUS_SUCCESS] = "success",