[PATCH] BSD Log Spamming

Cy Schubert <[email protected]> Tue, 19 May 2020 22:09:06 -0700
Newsgroups gmane.linux.drivers.hostap
Message-ID <[email protected]>
Hi,

On BSD, specifically FreeBSD, when disabling the RF radio on a laptop with 
communication device toggle key (as it's called on my laptop) otherwise 
known as the RF radio kill button, the following errors will be issued once 
per second:

May 19 17:58:35 slippy wpa_supplicant[391]: wlan0: CTRL-EVENT-SCAN-FAILED 
ret=-1 retry=1
May 19 17:58:36 slippy wpa_supplicant[391]: ioctl[SIOCS80211, op=103, 
val=0, arg_len=128]: Device not configured

On Intel the device will remain up however the IFF_RUNNING flag indicates 
whether the device is actually enabled and active. The following patch 
tests for this and avoids spamming syslog when RF is disabled.

  Silence the once per second CTRL-EVENT-SCAN-FAILED errors when the WiFi
  radio is disabled through the communication device toggle key (also known
  as the RF raidio kill button). Only the CTRL-EVENT-DISCONNECTED will be
  issued.

Index: contrib/wpa/src/drivers/driver_bsd.c
===================================================================
--- contrib/wpa/src/drivers/driver_bsd.c	(revision 361269)
+++ contrib/wpa/src/drivers/driver_bsd.c	(working copy)
@@ -1358,14 +1358,18 @@
 		drv = bsd_get_drvindex(global, ifm->ifm_index);
 		if (drv == NULL)
 			return;
-		if ((ifm->ifm_flags & IFF_UP) == 0 &&
-		    (drv->flags & IFF_UP) != 0) {
+		if (((ifm->ifm_flags & IFF_UP) == 0 ||
+		    (ifm->ifm_flags & IFF_RUNNING) == 0) &&
+		    (drv->flags & IFF_UP) != 0 &&
+		    (drv->flags & IFF_RUNNING) != 0) {
 			wpa_printf(MSG_DEBUG, "RTM_IFINFO: Interface '%s' DOWN",
 				   drv->ifname);
 			wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_DISABLED,
 					     NULL);
 		} else if ((ifm->ifm_flags & IFF_UP) != 0 &&
-		    (drv->flags & IFF_UP) == 0) {
+		    (ifm->ifm_flags & IFF_RUNNING) != 0 &&
+		    ((drv->flags & IFF_UP) == 0 ||
+		    (drv->flags & IFF_RUNNING)  == 0)) {
 			wpa_printf(MSG_DEBUG, "RTM_IFINFO: Interface '%s' UP",
 				   drv->ifname);
 			wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_ENABLED,


Thoughts?


-- 
Cheers,
Cy Schubert <[email protected]>
FreeBSD UNIX:  <[email protected]>   Web:  https://FreeBSD.org
NTP:           <[email protected]>    Web:  https://nwtime.org

	The need of the many outweighs the greed of the few.