[PATCH] BSD: don't log SIOCG80211 errors during interface setup

Roy Marples roy at marples.name
Tue Jul 21 06:53:55 EDT 2020


Unless debugging.
wpa_supplicant will log it failed to initialized the driver for the
interface anyway so this just silences some noise for users.

Signed-off-by: Roy Marples <roy at marples.name>
---
  src/drivers/driver_bsd.c | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/drivers/driver_bsd.c b/src/drivers/driver_bsd.c
index 5adee13a2..a29d2c801 100644
--- a/src/drivers/driver_bsd.c
+++ b/src/drivers/driver_bsd.c
@@ -137,7 +137,9 @@ bsd_get80211(void *priv, struct ieee80211req *ireq, int op, 
void *arg,
  	ireq->i_data = arg;

  	if (ioctl(drv->global->sock, SIOCG80211, ireq) < 0) {
-		wpa_printf(MSG_ERROR, "ioctl[SIOCG80211, op=%u, "
+		int level = drv->if_removed ? MSG_DEBUG : MSG_ERROR;
+
+		wpa_printf(level, "ioctl[SIOCG80211, op=%u, "
  			   "arg_len=%u]: %s", op, arg_len, strerror(errno));
  		return -1;
  	}
@@ -1468,6 +1470,9 @@ wpa_driver_bsd_init(void *ctx, const char *ifname, void *priv)
  	drv->global = priv;
  	os_strlcpy(drv->ifname, ifname, sizeof(drv->ifname));

+	/* Set the interface as removed until proven to work. */
+	drv->if_removed = 1;
+
  	if (!GETPARAM(drv, IEEE80211_IOC_ROAMING, drv->prev_roaming)) {
  		wpa_printf(MSG_DEBUG, "%s: failed to get roaming state: %s",
  			__func__, strerror(errno));
@@ -1495,6 +1500,9 @@ wpa_driver_bsd_init(void *ctx, const char *ifname, void *priv)
  	if (bsd_get_iface_flags(drv) < 0)
  		goto fail;

+	/* Proven to work, lets go! */
+	drv->if_removed = 0;
+
  	drv->opmode = get80211opmode(drv);
  	dl_list_add(&drv->global->ifaces, &drv->list);

-- 
2.27.0



More information about the Hostap mailing list