git: 0c2beef72d1a - main - ifconfig: fix warnings #2

From: Alexander V. Chernikov <melifaro_at_FreeBSD.org>
Date: Thu, 01 Jun 2023 11:54:51 UTC
The branch main has been updated by melifaro:

URL: https://cgit.FreeBSD.org/src/commit/?id=0c2beef72d1a493d7bf9fe901f91aba35cc3b6e1

commit 0c2beef72d1a493d7bf9fe901f91aba35cc3b6e1
Author:     Alexander V. Chernikov <melifaro@FreeBSD.org>
AuthorDate: 2023-06-01 11:54:02 +0000
Commit:     Alexander V. Chernikov <melifaro@FreeBSD.org>
CommitDate: 2023-06-01 11:54:25 +0000

    ifconfig: fix warnings #2
    
    Fix all -Wparameter-unused and cast alignment
    
    Differential Revision: https://reviews.freebsd.org/D40303
    MFC after:      2 weeks
---
 sbin/ifconfig/af_inet.c          |   2 +-
 sbin/ifconfig/af_inet6.c         |   8 +-
 sbin/ifconfig/carp.c             |   5 +-
 sbin/ifconfig/ifbridge.c         |   6 +-
 sbin/ifconfig/ifclone.c          |   4 +-
 sbin/ifconfig/ifconfig.c         |   2 +-
 sbin/ifconfig/ifconfig.h         |  10 ++-
 sbin/ifconfig/ifconfig_netlink.c |   2 +-
 sbin/ifconfig/ifgif.c            |   2 +-
 sbin/ifconfig/ifgre.c            |   2 +-
 sbin/ifconfig/ifieee80211.c      | 166 +++++++++++++++++++--------------------
 sbin/ifconfig/iflagg.c           |   2 +-
 sbin/ifconfig/ifmedia.c          |  12 +--
 sbin/ifconfig/ifpfsync.c         |   9 +--
 sbin/ifconfig/ifvlan.c           |   4 +-
 sbin/ifconfig/ifvxlan.c          |   4 +-
 sbin/ifconfig/sfp.c              |   3 +-
 17 files changed, 125 insertions(+), 118 deletions(-)

diff --git a/sbin/ifconfig/af_inet.c b/sbin/ifconfig/af_inet.c
index 76787e62d908..df1d9cab959e 100644
--- a/sbin/ifconfig/af_inet.c
+++ b/sbin/ifconfig/af_inet.c
@@ -263,7 +263,7 @@ static struct in_px *sintab_nl[] = {
 };
 
 static void
-in_copyaddr(if_ctx *ctx, int to, int from)
+in_copyaddr(if_ctx *ctx __unused, int to, int from)
 {
 	sintab_nl[to]->addr = sintab_nl[from]->addr;
 	sintab_nl[to]->addrset = sintab_nl[from]->addrset;
diff --git a/sbin/ifconfig/af_inet6.c b/sbin/ifconfig/af_inet6.c
index f735afdc8797..f791646c5133 100644
--- a/sbin/ifconfig/af_inet6.c
+++ b/sbin/ifconfig/af_inet6.c
@@ -99,7 +99,7 @@ extern void nd6_status(if_ctx *);
 static	char addr_buf[NI_MAXHOST];	/*for getnameinfo()*/
 
 static void
-setifprefixlen(if_ctx *ctx, const char *addr, int dummy __unused)
+setifprefixlen(if_ctx *ctx __netlink_unused, const char *addr, int dummy __unused)
 {
 #ifdef WITHOUT_NETLINK
 	const struct afswtch *afp = ctx->afp;
@@ -385,7 +385,7 @@ show_lifetime(struct ifa_cacheinfo *ci)
 }
 
 static void
-in6_status_nl(if_ctx *ctx __unused, if_link_t *link, if_addr_t *ifa)
+in6_status_nl(if_ctx *ctx __unused, if_link_t *link __unused, if_addr_t *ifa)
 {
 	int plen = ifa->ifa_prefixlen;
 	uint32_t scopeid;
@@ -422,7 +422,7 @@ static struct in6_px *sin6tab_nl[] = {
 };
 
 static void
-in6_copyaddr(if_ctx *ctx, int to, int from)
+in6_copyaddr(if_ctx *ctx __unused, int to, int from)
 {
 	sin6tab_nl[to]->addr = sin6tab_nl[from]->addr;
 	sin6tab_nl[to]->set = sin6tab_nl[from]->set;
@@ -771,7 +771,7 @@ static struct afswtch af_inet6 = {
 };
 
 static void
-in6_Lopt_cb(const char *optarg __unused)
+in6_Lopt_cb(const char *arg __unused)
 {
 	ip6lifetime++;	/* print IPv6 address lifetime */
 }
diff --git a/sbin/ifconfig/carp.c b/sbin/ifconfig/carp.c
index d4978d53f083..18f0eb893752 100644
--- a/sbin/ifconfig/carp.c
+++ b/sbin/ifconfig/carp.c
@@ -114,7 +114,7 @@ setcarp_vhid(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-setcarp_callback(int s, void *arg __unused)
+setcarp_callback(int s __unused, void *arg __unused)
 {
 	struct ifconfig_carp carpr = { };
 
@@ -214,8 +214,7 @@ setcarp_peer6(if_ctx *ctx __unused, const char *val, int dummy __unused)
 	if (getaddrinfo(val, NULL, &hints, &res) != 0)
 		errx(1, "Invalid IPv6 address %s", val);
 
-	memcpy(&carp_addr6, &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr,
-	    sizeof(carp_addr6));
+	memcpy(&carp_addr6, &(satosin6(res->ai_addr))->sin6_addr, sizeof(carp_addr6));
 	freeaddrinfo(res);
 }
 
diff --git a/sbin/ifconfig/ifbridge.c b/sbin/ifconfig/ifbridge.c
index 9d3c64a184b4..c8e7111e6722 100644
--- a/sbin/ifconfig/ifbridge.c
+++ b/sbin/ifconfig/ifbridge.c
@@ -373,7 +373,7 @@ unsetbridge_autoptp(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-setbridge_flush(if_ctx *ctx, const char *val, int dummy __unused)
+setbridge_flush(if_ctx *ctx, const char *val __unused, int dummy __unused)
 {
 	struct ifbreq req;
 
@@ -384,7 +384,7 @@ setbridge_flush(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-setbridge_flushall(if_ctx *ctx, const char *val, int dummy __unused)
+setbridge_flushall(if_ctx *ctx, const char *val __unused, int dummy __unused)
 {
 	struct ifbreq req;
 
@@ -434,7 +434,7 @@ setbridge_deladdr(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-setbridge_addr(if_ctx *ctx, const char *val, int dummy __unused)
+setbridge_addr(if_ctx *ctx, const char *val __unused, int dummy __unused)
 {
 
 	bridge_addresses(ctx->io_s, "");
diff --git a/sbin/ifconfig/ifclone.c b/sbin/ifconfig/ifclone.c
index 0894366bb185..9c71a218b72a 100644
--- a/sbin/ifconfig/ifclone.c
+++ b/sbin/ifconfig/ifclone.c
@@ -118,7 +118,7 @@ clone_setdefcallback_filter(clone_match_func *filter, clone_callback_func *p)
  * no parameters.
  */
 static void
-ifclonecreate(int s, void *arg)
+ifclonecreate(int s, void *arg __unused)
 {
 	struct ifreq ifr;
 	struct clone_defcb *dcp;
@@ -182,7 +182,7 @@ static struct cmd clone_cmds[] = {
 };
 
 static void
-clone_Copt_cb(const char *optarg __unused)
+clone_Copt_cb(const char *arg __unused)
 {
 	list_cloners();
 	exit(exit_code);
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 84df15a58ce1..06cfefc5a466 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1776,7 +1776,7 @@ status(struct ifconfig_args *args, const struct sockaddr_dl *sdl,
 
 	print_ifstatus(s);
 	if (args->verbose > 0)
-		sfp_status(s, &ifr, args->verbose);
+		sfp_status(ctx);
 
 	close(s);
 	return;
diff --git a/sbin/ifconfig/ifconfig.h b/sbin/ifconfig/ifconfig.h
index 054e7a12f488..fda3736ba430 100644
--- a/sbin/ifconfig/ifconfig.h
+++ b/sbin/ifconfig/ifconfig.h
@@ -43,6 +43,14 @@
 
 #define	__constructor	__attribute__((constructor))
 
+#ifdef WITHOUT_NETLINK
+#define	__netlink_used		__unused
+#define	__netlink_unused
+#else
+#define	__netlink_used
+#define	__netlink_unused	__unused
+#endif
+
 struct afswtch;
 struct cmd;
 struct ifconfig_context;
@@ -267,7 +275,7 @@ typedef void clone_callback_func(int, struct ifreq *);
 void	clone_setdefcallback_prefix(const char *, clone_callback_func *);
 void	clone_setdefcallback_filter(clone_match_func *, clone_callback_func *);
 
-void	sfp_status(int s, struct ifreq *ifr, int verbose);
+void	sfp_status(if_ctx *ctx);
 
 struct sockaddr_dl;
 bool	match_ether(const struct sockaddr_dl *sdl);
diff --git a/sbin/ifconfig/ifconfig_netlink.c b/sbin/ifconfig/ifconfig_netlink.c
index ebebea33f3f6..07e4429cfecb 100644
--- a/sbin/ifconfig/ifconfig_netlink.c
+++ b/sbin/ifconfig/ifconfig_netlink.c
@@ -398,7 +398,7 @@ status_nl(if_ctx *ctx, struct iface *iface)
 
 	print_ifstatus(ctx->io_s);
 	if (args->verbose > 0)
-		sfp_status(ctx->io_s, &ifr, args->verbose);
+		sfp_status(ctx);
 }
 
 static int
diff --git a/sbin/ifconfig/ifgif.c b/sbin/ifconfig/ifgif.c
index d4db020a37f7..759360bf2f00 100644
--- a/sbin/ifconfig/ifgif.c
+++ b/sbin/ifconfig/ifgif.c
@@ -70,7 +70,7 @@ gif_status(if_ctx *ctx)
 }
 
 static void
-setgifopts(if_ctx *ctx, const char *val, int d)
+setgifopts(if_ctx *ctx, const char *val __unused, int d)
 {
 	int opts;
 
diff --git a/sbin/ifconfig/ifgre.c b/sbin/ifconfig/ifgre.c
index 680c1387c338..a01185beac5c 100644
--- a/sbin/ifconfig/ifgre.c
+++ b/sbin/ifconfig/ifgre.c
@@ -91,7 +91,7 @@ setifgreport(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-setifgreopts(if_ctx *ctx, const char *val, int d)
+setifgreopts(if_ctx *ctx, const char *val __unused, int d)
 {
 	uint32_t opts;
 
diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c
index 15203f9ce6e0..c096428dd3a8 100644
--- a/sbin/ifconfig/ifieee80211.c
+++ b/sbin/ifconfig/ifieee80211.c
@@ -899,7 +899,7 @@ set80211powersavemode(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-set80211powersave(if_ctx *ctx, const char *val, int d)
+set80211powersave(if_ctx *ctx, const char *val __unused, int d)
 {
 	int s = ctx->io_s;
 
@@ -936,7 +936,7 @@ set80211wepmode(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-set80211wep(if_ctx *ctx, const char *val, int d)
+set80211wep(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_WEP, d, 0, NULL);
 }
@@ -1097,31 +1097,31 @@ set80211roaming(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-set80211wme(if_ctx *ctx, const char *val, int d)
+set80211wme(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_WME, d, 0, NULL);
 }
 
 static void
-set80211hidessid(if_ctx *ctx, const char *val, int d)
+set80211hidessid(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_HIDESSID, d, 0, NULL);
 }
 
 static void
-set80211apbridge(if_ctx *ctx, const char *val, int d)
+set80211apbridge(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_APBRIDGE, d, 0, NULL);
 }
 
 static void
-set80211fastframes(if_ctx *ctx, const char *val, int d)
+set80211fastframes(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_FF, d, 0, NULL);
 }
 
 static void
-set80211dturbo(if_ctx *ctx, const char *val, int d)
+set80211dturbo(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_TURBOP, d, 0, NULL);
 }
@@ -1366,7 +1366,7 @@ set80211kickmac(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-set80211maccmd(if_ctx *ctx, const char *val, int d)
+set80211maccmd(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_MACCMD, d, 0, NULL);
 }
@@ -1404,7 +1404,7 @@ set80211delmeshrt(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-set80211meshrtcmd(if_ctx *ctx, const char *val, int d)
+set80211meshrtcmd(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_MESH_RTCMD, d, 0, NULL);
 }
@@ -1432,13 +1432,13 @@ set80211hwmpmaxhops(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-set80211pureg(if_ctx *ctx, const char *val, int d)
+set80211pureg(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_PUREG, d, 0, NULL);
 }
 
 static void
-set80211quiet(if_ctx *ctx, const char *val, int d)
+set80211quiet(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_QUIET, d, 0, NULL);
 }
@@ -1468,7 +1468,7 @@ set80211quietoffset(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-set80211bgscan(if_ctx *ctx, const char *val, int d)
+set80211bgscan(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_BGSCAN, d, 0, NULL);
 }
@@ -1770,25 +1770,25 @@ set80211bmissthreshold(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-set80211burst(if_ctx *ctx, const char *val, int d)
+set80211burst(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_BURST, d, 0, NULL);
 }
 
 static void
-set80211doth(if_ctx *ctx, const char *val, int d)
+set80211doth(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_DOTH, d, 0, NULL);
 }
 
 static void
-set80211dfs(if_ctx *ctx, const char *val, int d)
+set80211dfs(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_DFS, d, 0, NULL);
 }
 
 static void
-set80211shortgi(if_ctx *ctx, const char *val, int d)
+set80211shortgi(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_SHORTGI,
 		d ? (IEEE80211_HTCAP_SHORTGI20 | IEEE80211_HTCAP_SHORTGI40) : 0,
@@ -1797,7 +1797,7 @@ set80211shortgi(if_ctx *ctx, const char *val, int d)
 
 /* XXX 11ac density/size is different */
 static void
-set80211ampdu(if_ctx *ctx, const char *val, int d)
+set80211ampdu(if_ctx *ctx, const char *val __unused, int d)
 {
 	int ampdu;
 	int s = ctx->io_s;
@@ -1813,7 +1813,7 @@ set80211ampdu(if_ctx *ctx, const char *val, int d)
 }
 
 static void
-set80211stbc(if_ctx *ctx, const char *val, int d)
+set80211stbc(if_ctx *ctx, const char *val __unused, int d)
 {
 	int stbc;
 	int s = ctx->io_s;
@@ -1829,7 +1829,7 @@ set80211stbc(if_ctx *ctx, const char *val, int d)
 }
 
 static void
-set80211ldpc(if_ctx *ctx, const char *val, int d)
+set80211ldpc(if_ctx *ctx, const char *val __unused, int d)
 {
 	int s = ctx->io_s;
         int ldpc;
@@ -1845,7 +1845,7 @@ set80211ldpc(if_ctx *ctx, const char *val, int d)
 }
 
 static void
-set80211uapsd(if_ctx *ctx, const char *val, int d)
+set80211uapsd(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_UAPSD, d, 0, NULL);
 }
@@ -1918,7 +1918,7 @@ set80211ampdudensity(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-set80211amsdu(if_ctx *ctx, const char *val, int d)
+set80211amsdu(if_ctx *ctx, const char *val __unused, int d)
 {
 	int amsdu;
 
@@ -1939,62 +1939,62 @@ set80211amsdulimit(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-set80211puren(if_ctx *ctx, const char *val, int d)
+set80211puren(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_PUREN, d, 0, NULL);
 }
 
 static void
-set80211htcompat(if_ctx *ctx, const char *val, int d)
+set80211htcompat(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_HTCOMPAT, d, 0, NULL);
 }
 
 static void
-set80211htconf(if_ctx *ctx, const char *val, int d)
+set80211htconf(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_HTCONF, d, 0, NULL);
 	htconf = d;
 }
 
 static void
-set80211dwds(if_ctx *ctx, const char *val, int d)
+set80211dwds(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_DWDS, d, 0, NULL);
 }
 
 static void
-set80211inact(if_ctx *ctx, const char *val, int d)
+set80211inact(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_INACTIVITY, d, 0, NULL);
 }
 
 static void
-set80211tsn(if_ctx *ctx, const char *val, int d)
+set80211tsn(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_TSN, d, 0, NULL);
 }
 
 static void
-set80211dotd(if_ctx *ctx, const char *val, int d)
+set80211dotd(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_DOTD, d, 0, NULL);
 }
 
 static void
-set80211smps(if_ctx *ctx, const char *val, int d)
+set80211smps(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_SMPS, d, 0, NULL);
 }
 
 static void
-set80211rifs(if_ctx *ctx, const char *val, int d)
+set80211rifs(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_RIFS, d, 0, NULL);
 }
 
 static void
-set80211vhtconf(if_ctx *ctx, const char *val, int d)
+set80211vhtconf(if_ctx *ctx, const char *val __unused, int d)
 {
 	int s = ctx->io_s;
 
@@ -2041,19 +2041,19 @@ set80211meshttl(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-set80211meshforward(if_ctx *ctx, const char *val, int d)
+set80211meshforward(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_MESH_FWRD, d, 0, NULL);
 }
 
 static void
-set80211meshgate(if_ctx *ctx, const char *val, int d)
+set80211meshgate(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_MESH_GATE, d, 0, NULL);
 }
 
 static void
-set80211meshpeering(if_ctx *ctx, const char *val, int d)
+set80211meshpeering(if_ctx *ctx, const char *val __unused, int d)
 {
 	set80211(ctx->io_s, IEEE80211_IOC_MESH_AP, d, 0, NULL);
 }
@@ -2565,7 +2565,7 @@ set80211country(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-set80211location(if_ctx *ctx, const char *val, int d)
+set80211location(if_ctx *ctx, const char *val __unused, int d)
 {
 	getregdomain(ctx->io_s);
 	regdomain.location = d;
@@ -2573,7 +2573,7 @@ set80211location(if_ctx *ctx, const char *val, int d)
 }
 
 static void
-set80211ecm(if_ctx *ctx, const char *val, int d)
+set80211ecm(if_ctx *ctx, const char *val __unused, int d)
 {
 	getregdomain(ctx->io_s);
 	regdomain.ecm = d;
@@ -2757,7 +2757,7 @@ printie(const char* tag, const uint8_t *ie, size_t ielen, unsigned int maxlen)
  */
 
 static void
-printwmeparam(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+printwmeparam(const char *tag, const u_int8_t *ie)
 {
 	static const char *acnames[] = { "BE", "BK", "VO", "VI" };
 	const struct ieee80211_wme_param *wme =
@@ -2787,7 +2787,7 @@ printwmeparam(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
 }
 
 static void
-printwmeinfo(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+printwmeinfo(const char *tag, const u_int8_t *ie)
 {
 	printf("%s", tag);
 	if (verbose) {
@@ -2799,7 +2799,7 @@ printwmeinfo(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
 }
 
 static void
-printvhtcap(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+printvhtcap(const char *tag, const u_int8_t *ie)
 {
 	printf("%s", tag);
 	if (verbose) {
@@ -2822,7 +2822,7 @@ printvhtcap(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
 }
 
 static void
-printvhtinfo(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+printvhtinfo(const char *tag, const u_int8_t *ie)
 {
 	printf("%s", tag);
 	if (verbose) {
@@ -2838,7 +2838,7 @@ printvhtinfo(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
 }
 
 static void
-printvhtpwrenv(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+printvhtpwrenv(const char *tag, const u_int8_t *ie, size_t ielen)
 {
 	printf("%s", tag);
 	static const char *txpwrmap[] = {
@@ -2871,7 +2871,7 @@ printvhtpwrenv(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
 }
 
 static void
-printhtcap(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+printhtcap(const char *tag, const u_int8_t *ie)
 {
 	printf("%s", tag);
 	if (verbose) {
@@ -2905,7 +2905,7 @@ printhtcap(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
 }
 
 static void
-printhtinfo(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+printhtinfo(const char *tag, const u_int8_t *ie)
 {
 	printf("%s", tag);
 	if (verbose) {
@@ -2937,7 +2937,7 @@ printhtinfo(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
 }
 
 static void
-printathie(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+printathie(const char *tag, const u_int8_t *ie)
 {
 
 	printf("%s", tag);
@@ -2968,7 +2968,7 @@ printathie(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
 
 
 static void
-printmeshconf(const char *tag, const uint8_t *ie, size_t ielen, int maxlen)
+printmeshconf(const char *tag, const uint8_t *ie)
 {
 
 	printf("%s", tag);
@@ -3006,7 +3006,7 @@ printmeshconf(const char *tag, const uint8_t *ie, size_t ielen, int maxlen)
 }
 
 static void
-printbssload(const char *tag, const uint8_t *ie, size_t ielen, int maxlen)
+printbssload(const char *tag, const uint8_t *ie)
 {
 	printf("%s", tag);
 	if (verbose) {
@@ -3020,7 +3020,7 @@ printbssload(const char *tag, const uint8_t *ie, size_t ielen, int maxlen)
 }
 
 static void
-printapchanrep(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+printapchanrep(const char *tag, const u_int8_t *ie, size_t ielen)
 {
 	printf("%s", tag);
 	if (verbose) {
@@ -3079,7 +3079,7 @@ wpa_keymgmt(const u_int8_t *sel)
 }
 
 static void
-printwpaie(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+printwpaie(const char *tag, const u_int8_t *ie)
 {
 	u_int8_t len = ie[1];
 
@@ -3165,7 +3165,7 @@ rsn_keymgmt(const u_int8_t *sel)
 }
 
 static void
-printrsnie(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+printrsnie(const char *tag, const u_int8_t *ie, size_t ielen)
 {
 	printf("%s", tag);
 	if (verbose) {
@@ -3213,7 +3213,7 @@ printrsnie(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
 	  (((const u_int8_t *)(p))[0] <<  8)))
 
 static void
-printwpsie(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+printwpsie(const char *tag, const u_int8_t *ie)
 {
 	u_int8_t len = ie[1];
 
@@ -3443,7 +3443,7 @@ printwpsie(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
 }
 
 static void
-printtdmaie(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+printtdmaie(const char *tag, const u_int8_t *ie, size_t ielen)
 {
 	printf("%s", tag);
 	if (verbose && ielen >= sizeof(struct ieee80211_tdma_param)) {
@@ -3501,7 +3501,7 @@ copy_essid(char buf[], size_t bufsize, const u_int8_t *essid, size_t essid_len)
 }
 
 static void
-printssid(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+printssid(const char *tag, const u_int8_t *ie, int maxlen)
 {
 	char ssid[2*IEEE80211_NWID_LEN+1];
 
@@ -3509,7 +3509,7 @@ printssid(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
 }
 
 static void
-printrates(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+printrates(const char *tag, const u_int8_t *ie, size_t ielen)
 {
 	const char *sep;
 
@@ -3525,7 +3525,7 @@ printrates(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
 }
 
 static void
-printcountry(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
+printcountry(const char *tag, const u_int8_t *ie)
 {
 	const struct ieee80211_country_ie *cie =
 	   (const struct ieee80211_country_ie *) ie;
@@ -3628,13 +3628,13 @@ printies(const u_int8_t *vp, int ielen, unsigned int maxcols)
 		switch (vp[0]) {
 		case IEEE80211_ELEMID_SSID:
 			if (verbose)
-				printssid(" SSID", vp, 2+vp[1], maxcols);
+				printssid(" SSID", vp, maxcols);
 			break;
 		case IEEE80211_ELEMID_RATES:
 		case IEEE80211_ELEMID_XRATES:
 			if (verbose)
 				printrates(vp[0] == IEEE80211_ELEMID_RATES ?
-				    " RATES" : " XRATES", vp, 2+vp[1], maxcols);
+				    " RATES" : " XRATES", vp, 2+vp[1]);
 			break;
 		case IEEE80211_ELEMID_DSPARMS:
 			if (verbose)
@@ -3642,7 +3642,7 @@ printies(const u_int8_t *vp, int ielen, unsigned int maxcols)
 			break;
 		case IEEE80211_ELEMID_COUNTRY:
 			if (verbose)
-				printcountry(" COUNTRY", vp, 2+vp[1], maxcols);
+				printcountry(" COUNTRY", vp);
 			break;
 		case IEEE80211_ELEMID_ERP:
 			if (verbose)
@@ -3650,51 +3650,51 @@ printies(const u_int8_t *vp, int ielen, unsigned int maxcols)
 			break;
 		case IEEE80211_ELEMID_VENDOR:
 			if (iswpaoui(vp))
-				printwpaie(" WPA", vp, 2+vp[1], maxcols);
+				printwpaie(" WPA", vp);
 			else if (iswmeinfo(vp))
-				printwmeinfo(" WME", vp, 2+vp[1], maxcols);
+				printwmeinfo(" WME", vp);
 			else if (iswmeparam(vp))
-				printwmeparam(" WME", vp, 2+vp[1], maxcols);
+				printwmeparam(" WME", vp);
 			else if (isatherosoui(vp))
-				printathie(" ATH", vp, 2+vp[1], maxcols);
+				printathie(" ATH", vp);
 			else if (iswpsoui(vp))
-				printwpsie(" WPS", vp, 2+vp[1], maxcols);
+				printwpsie(" WPS", vp);
 			else if (istdmaoui(vp))
-				printtdmaie(" TDMA", vp, 2+vp[1], maxcols);
+				printtdmaie(" TDMA", vp, 2+vp[1]);
 			else if (verbose)
 				printie(" VEN", vp, 2+vp[1], maxcols);
 			break;
 		case IEEE80211_ELEMID_RSN:
-			printrsnie(" RSN", vp, 2+vp[1], maxcols);
+			printrsnie(" RSN", vp, 2+vp[1]);
 			break;
 		case IEEE80211_ELEMID_HTCAP:
-			printhtcap(" HTCAP", vp, 2+vp[1], maxcols);
+			printhtcap(" HTCAP", vp);
 			break;
 		case IEEE80211_ELEMID_HTINFO:
 			if (verbose)
-				printhtinfo(" HTINFO", vp, 2+vp[1], maxcols);
+				printhtinfo(" HTINFO", vp);
 			break;
 		case IEEE80211_ELEMID_MESHID:
 			if (verbose)
-				printssid(" MESHID", vp, 2+vp[1], maxcols);
+				printssid(" MESHID", vp, maxcols);
 			break;
 		case IEEE80211_ELEMID_MESHCONF:
-			printmeshconf(" MESHCONF", vp, 2+vp[1], maxcols);
+			printmeshconf(" MESHCONF", vp);
 			break;
 		case IEEE80211_ELEMID_VHT_CAP:
-			printvhtcap(" VHTCAP", vp, 2+vp[1], maxcols);
+			printvhtcap(" VHTCAP", vp);
 			break;
 		case IEEE80211_ELEMID_VHT_OPMODE:
-			printvhtinfo(" VHTOPMODE", vp, 2+vp[1], maxcols);
+			printvhtinfo(" VHTOPMODE", vp);
 			break;
 		case IEEE80211_ELEMID_VHT_PWR_ENV:
-			printvhtpwrenv(" VHTPWRENV", vp, 2+vp[1], maxcols);
+			printvhtpwrenv(" VHTPWRENV", vp, 2+vp[1]);
 			break;
 		case IEEE80211_ELEMID_BSSLOAD:
-			printbssload(" BSSLOAD", vp, 2+vp[1], maxcols);
+			printbssload(" BSSLOAD", vp);
 			break;
 		case IEEE80211_ELEMID_APCHANREP:
-			printapchanrep(" APCHANREP", vp, 2+vp[1], maxcols);
+			printapchanrep(" APCHANREP", vp, 2+vp[1]);
 			break;
 		default:
 			if (verbose)
@@ -3855,7 +3855,7 @@ scan_and_wait(int s)
 }
 
 static void
-set80211scan(if_ctx *ctx, const char *val, int dummy __unused)
+set80211scan(if_ctx *ctx, const char *val __unused, int dummy __unused)
 {
 	scan_and_wait(ctx->io_s);
 	list_scan(ctx->io_s);
@@ -3950,7 +3950,7 @@ list_stations(int s)
 	do {
 		const struct ieee80211req_sta_info *si;
 
-		si = (const struct ieee80211req_sta_info *) cp;
+		si = (const struct ieee80211req_sta_info *)(const void *)cp;
 		if (si->isi_len < sizeof(*si))
 			break;
 		if (opmode == IEEE80211_M_MBSS)
@@ -4268,7 +4268,7 @@ list_txpow(int s)
 }
 
 static void
-list_keys(int s)
+list_keys(int s __unused)
 {
 }
 
@@ -5808,13 +5808,13 @@ wlan_create(int s, struct ifreq *ifr)
 }
 
 static void
-set80211clone_wlandev(if_ctx *ctx, const char *arg, int dummy __unused)
+set80211clone_wlandev(if_ctx *ctx __unused, const char *arg, int dummy __unused)
 {
 	strlcpy(params.icp_parent, arg, IFNAMSIZ);
 }
 
 static void
-set80211clone_wlanbssid(if_ctx *ctx, const char *arg, int dummy __unused)
+set80211clone_wlanbssid(if_ctx *ctx __unused, const char *arg, int dummy __unused)
 {
 	const struct ether_addr *ea;
 
@@ -5825,7 +5825,7 @@ set80211clone_wlanbssid(if_ctx *ctx, const char *arg, int dummy __unused)
 }
 
 static void
-set80211clone_wlanaddr(if_ctx *ctx, const char *arg, int dummy __unused)
+set80211clone_wlanaddr(if_ctx *ctx __unused, const char *arg, int dummy __unused)
 {
 	const struct ether_addr *ea;
 
@@ -5837,7 +5837,7 @@ set80211clone_wlanaddr(if_ctx *ctx, const char *arg, int dummy __unused)
 }
 
 static void
-set80211clone_wlanmode(if_ctx *ctx, const char *arg, int dummy __unused)
+set80211clone_wlanmode(if_ctx *ctx __unused, const char *arg, int dummy __unused)
 {
 #define	iseq(a,b)	(strncasecmp(a,b,sizeof(b)-1) == 0)
 	if (iseq(arg, "sta"))
@@ -5863,7 +5863,7 @@ set80211clone_wlanmode(if_ctx *ctx, const char *arg, int dummy __unused)
 }
 
 static void
-set80211clone_beacons(if_ctx *ctx, const char *val, int d)
+set80211clone_beacons(if_ctx *ctx __unused, const char *val __unused, int d)
 {
 	/* NB: inverted sense */
 	if (d)
@@ -5873,7 +5873,7 @@ set80211clone_beacons(if_ctx *ctx, const char *val, int d)
 }
 
 static void
-set80211clone_bssid(if_ctx *ctx, const char *val, int d)
+set80211clone_bssid(if_ctx *ctx __unused, const char *val __unused, int d)
 {
 	if (d)
 		params.icp_flags |= IEEE80211_CLONE_BSSID;
@@ -5882,7 +5882,7 @@ set80211clone_bssid(if_ctx *ctx, const char *val, int d)
 }
 
 static void
-set80211clone_wdslegacy(if_ctx *ctx, const char *val, int d)
+set80211clone_wdslegacy(if_ctx *ctx __unused, const char *val __unused, int d)
 {
 	if (d)
 		params.icp_flags |= IEEE80211_CLONE_WDSLEGACY;
diff --git a/sbin/ifconfig/iflagg.c b/sbin/ifconfig/iflagg.c
index 2fdb7a052d9d..5bb1fa6161b0 100644
--- a/sbin/ifconfig/iflagg.c
+++ b/sbin/ifconfig/iflagg.c
@@ -294,7 +294,7 @@ lagg_status(if_ctx *ctx __unused)
 }
 
 static void
-setlaggtype(if_ctx *ctx, const char *arg, int dummy __unused)
+setlaggtype(if_ctx *ctx __unused, const char *arg, int dummy __unused)
 {
 	static const struct lagg_types lt[] = LAGG_TYPES;
 
diff --git a/sbin/ifconfig/ifmedia.c b/sbin/ifconfig/ifmedia.c
index 520206790278..0774727a9444 100644
--- a/sbin/ifconfig/ifmedia.c
+++ b/sbin/ifconfig/ifmedia.c
@@ -90,7 +90,7 @@
 
 #include "ifconfig.h"
 
-static void domediaopt(const char *, bool, int);
+static void domediaopt(const char *, bool);
 static ifmedia_t get_media_subtype(ifmedia_t, const char *);
 static ifmedia_t get_media_mode(ifmedia_t, const char *);
 static ifmedia_t get_media_options(ifmedia_t, const char *);
@@ -217,21 +217,21 @@ setmedia(if_ctx *ctx __unused, const char *val, int d __unused)
 }
 
 static void
-setmediaopt(if_ctx *ctx, const char *val, int d __unused)
+setmediaopt(if_ctx *ctx __unused, const char *val, int d __unused)
 {
 
-	domediaopt(val, false, ctx->io_s);
+	domediaopt(val, false);
 }
 
 static void
-unsetmediaopt(if_ctx *ctx, const char *val, int d __unused)
+unsetmediaopt(if_ctx *ctx __unused, const char *val, int d __unused)
 {
 
-	domediaopt(val, true, ctx->io_s);
+	domediaopt(val, true);
 }
 
 static void
-domediaopt(const char *val, bool clear, int s)
+domediaopt(const char *val, bool clear)
 {
 	struct ifmediareq *ifmr;
 	ifmedia_t options;
diff --git a/sbin/ifconfig/ifpfsync.c b/sbin/ifconfig/ifpfsync.c
index de2a2445afb4..81bf463db117 100644
--- a/sbin/ifconfig/ifpfsync.c
+++ b/sbin/ifconfig/ifpfsync.c
@@ -185,7 +185,7 @@ setpfsync_syncdev(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-unsetpfsync_syncdev(if_ctx *ctx, const char *val, int dummy __unused)
+unsetpfsync_syncdev(if_ctx *ctx, const char *val __unused, int dummy __unused)
 {
 	nvlist_t *nvl = nvlist_create(0);
 
@@ -220,8 +220,7 @@ setpfsync_syncpeer(if_ctx *ctx, const char *val, int dummy __unused)
 	switch (peerres->ai_family) {
 #ifdef INET
 	case AF_INET: {
-		struct sockaddr_in *sin = (struct sockaddr_in *)
-					      peerres->ai_addr;
+		struct sockaddr_in *sin = satosin(peerres->ai_addr);
 
 		if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
 			errx(1, "syncpeer address cannot be multicast");
@@ -248,7 +247,7 @@ setpfsync_syncpeer(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-unsetpfsync_syncpeer(if_ctx *ctx, const char *val, int dummy __unused)
+unsetpfsync_syncpeer(if_ctx *ctx, const char *val __unused, int dummy __unused)
 {
 	struct sockaddr_storage addr;
 	memset(&addr, 0, sizeof(addr));
@@ -293,7 +292,7 @@ setpfsync_maxupd(if_ctx *ctx, const char *val, int dummy __unused)
 }
 
 static void
-setpfsync_defer(if_ctx *ctx, const char *val, int d)
+setpfsync_defer(if_ctx *ctx, const char *val __unused, int d)
 {
 	nvlist_t *nvl = nvlist_create(0);
 
diff --git a/sbin/ifconfig/ifvlan.c b/sbin/ifconfig/ifvlan.c
index cfae08565611..6dfc990d0558 100644
--- a/sbin/ifconfig/ifvlan.c
+++ b/sbin/ifconfig/ifvlan.c
@@ -176,7 +176,7 @@ vlan_create(int s, struct ifreq *ifr)
 }
 
 static void
-vlan_cb(int s, void *arg)
+vlan_cb(int s __unused, void *arg __unused)
 {
 	if ((params.vlr_tag != NOTAG) ^ (params.vlr_parent[0] != '\0'))
 		errx(1, "both vlan and vlandev must be specified");
@@ -263,7 +263,7 @@ setvlanpcp(if_ctx *ctx, const char *val, int dummy __unused)
*** 50 LINES SKIPPED ***