NetBSD Problem Report #57992

From www@netbsd.org  Sun Mar  3 10:39:44 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id A41321A9239
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  3 Mar 2024 10:39:44 +0000 (UTC)
Message-Id: <20240303103942.CC8D91A923A@mollari.NetBSD.org>
Date: Sun,  3 Mar 2024 10:39:42 +0000 (UTC)
From: ea1abz@gmail.com
Reply-To: ea1abz@gmail.com
To: gnats-bugs@NetBSD.org
Subject: urtwn (and athn) driver lost network when WIFI router changes channel
X-Send-Pr-Version: www-1.0

>Number:         57992
>Category:       kern
>Synopsis:       urtwn (and athn) driver lost network when WIFI router changes channel
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 03 10:40:00 +0000 2024
>Last-Modified:  Fri Mar 08 07:50:01 +0000 2024
>Originator:     Ramiro Aceves
>Release:        10.0_RC5
>Organization:
>Environment:
NetBSD netbsd-raspa 10.0_RC5 NetBSD 10.0_RC5 (RPI) #0: Tue Feb 27 05:27:39 UTC 2024  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/RPI evbarm

>Description:
Hello,

I am using urtwn driver in my RaspberryPi Zero W with a TPLink TL-WN-725N WIFI dongle.

If I force a channel change in the router, the network is lost and I cannot recover it. "service wpa_supplicant restart" does not recover network. "ifconfig urtwn0 down" and up does not fix it.

I have also noticed the same behaviour in my Acer Aspire One amd64 laptop that uses athn driver. But in this case "service wpa_supplicant restart" recovers network.

Just when network fails I recorded the output of the following commands:


# ifconfig urtwn0
urtwn0: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	ssid MiFibra-3422 nwkey 65536:"",0x433cc28429aedde0f4f22d14c5032697,"",""
	powersave off
	bssid 60:8d:26:32:34:24 chan 1
	address: e4:fa:c4:52:ac:4c
	media: IEEE802.11 autoselect (OFDM54 mode 11g)
	status: active
	inet6 fe80::e6fa:c4ff:fe52:ac4c%urtwn0/64 flags 0 scopeid 0x1
	inet 192.168.1.230/24 broadcast 192.168.1.255 flags 0
# wpa_cli status
Selected interface 'urtwn0'
22:32:36.067: bssid=60:8d:26:32:34:24
freq=0
ssid=MiFibra-3422
id=0
mode=station
pairwise_cipher=CCMP
group_cipher=CCMP
key_mgmt=WPA2-PSK
wpa_state=COMPLETED
ip_address=192.168.1.230
address=e4:fa:c4:52:ac:4c

I am not using dhcpd, I use static IP address.

netbsd-raspa# cat /etc/rc.conf
...
...

}

rc_configured=YES

hostname=netbsd-raspa
dhcpcd=NO

auto_ifconfig=YES
#ifconfig_bwfm0="inet 192.168.1.230 netmask 255.255.255.0"
ifconfig_urtwn0="inet 192.168.1.230 netmask 255.255.255.0"
wpa_supplicant=YES
wpa_supplicant_flags="-B -s -i urtwn0 -D bsd -c /etc/wpa_supplicant.conf"
defaultroute=192.168.1.1
no_swap=YES
savecore=NO
sshd=YES
ntpd=YES
ntpd_flags="-g"
creds_msdos=YES
creds_msdos_partition=/boot
certctl_init=YES
resize_disklabel=YES
resize_root=YES
resize_root_flags="-p"
resize_root_postcmd="/sbin/reboot -n"
wscons=YES
devpubd=YES
nettest=YES

minidlna=YES

This is weird because some times early in the night, I think my ISP makes mantainance operations in the router that change router settings. I have configured a fixed 11 channel setup and after several days it changed to auto channel without doing anything on my side. Perhaps they update firmware when they want. Who knows...

I have a rebooting script that reboots the machine if ping to www.google.com fails 3 times spaced at 5 minutes intervals, just to ensure not loosing SSH access to the headless Raspberry Pi. 

Thanks so much.
Ramiro







>How-To-Repeat:
Change WIFI channel in the router and network is lost.
>Fix:
Configure the router at a fixed channel (not a real fix)

>Audit-Trail:
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/57992: urtwn (and athn) driver lost network when WIFI router changes channel
Date: Sun, 3 Mar 2024 13:29:58 -0000 (UTC)

 ea1abz@gmail.com writes:

 >If I force a channel change in the router, the network is lost and I cannot recover it. "service wpa_supplicant restart" does not recover network. "ifconfig urtwn0 down" and up does not fix it.

 While I can confirm that a channel change isn't recognized with urtwn(4),
 a restart of wpa_supplicant (or just a "scan" request from wpa_cli)
 causes a new scan and association with the network.

 An attempt to enable automatic scanning using the roaming options
 (e.g. bgscan) in wpa_supplicant.conf didn't help.

 N.B. The same experiment with iwm(4) causes a disconnect as soon as the
 access point switches channels and an immediate scan, but afterwards
 the scan results are always truncated and the network is never found.
 Only a reboot recovers iwm(4) from this state.

From: Ramiro Aceves <ea1abz@gmail.com>
To: "gnats-bugs@netbsd.org" <gnats-bugs@netbsd.org>
Cc: "kern-bug-people@netbsd.org" <kern-bug-people@netbsd.org>, 
	"gnats-admin@netbsd.org" <gnats-admin@netbsd.org>, "netbsd-bugs@netbsd.org" <netbsd-bugs@netbsd.org>, 
	netbsd-users <netbsd-users@netbsd.org>
Subject: Re: kern/57992: urtwn (and athn) driver lost network when WIFI router
 changes channel
Date: Fri, 8 Mar 2024 08:45:55 +0100

 --000000000000d5a70e06132161aa
 Content-Type: text/plain; charset="UTF-8"
 Content-Transfer-Encoding: quoted-printable

 El domingo, 3 de marzo de 2024, Michael van Elst <mlelstv@serpens.de>
 escribi=C3=B3:
 > The following reply was made to PR kern/57992; it has been noted by GNATS=
 .
 >
 > From: mlelstv@serpens.de (Michael van Elst)
 > To: gnats-bugs@netbsd.org
 > Cc:
 > Subject: Re: kern/57992: urtwn (and athn) driver lost network when WIFI
 router changes channel
 > Date: Sun, 3 Mar 2024 13:29:58 -0000 (UTC)
 >
 >  ea1abz@gmail.com writes:
 >
 >  >If I force a channel change in the router, the network is lost and I
 cannot recover it. "service wpa_supplicant restart" does not recover
 network. "ifconfig urtwn0 down" and up does not fix it.
 >
 >  While I can confirm that a channel change isn't recognized with urtwn(4)=
 ,
 >  a restart of wpa_supplicant (or just a "scan" request from wpa_cli)
 >  causes a new scan and association with the network.
 >
 >  An attempt to enable automatic scanning using the roaming options
 >  (e.g. bgscan) in wpa_supplicant.conf didn't help.
 >
 >  N.B. The same experiment with iwm(4) causes a disconnect as soon as the
 >  access point switches channels and an immediate scan, but afterwards
 >  the scan results are always truncated and the network is never found.

 >  Only a reboot recovers iwm(4) from this state.
 >
 >
 Thanks Michael for sharing your experience.

 Yesterday I faced a new scenario. My raspberry pi zero w for unknown reason
 lost the network.

 My rebooting script detected it and rebooted the system but network did not
 recover. I connected the TV and I see that the system rebooted several
 times but network did no work. Each reboot spaced 15minutes cause my
 rebooting script used 3 ping retries at 5min intervals:

 netbsd-raspa# zcat /var/log/messages.0.gz|grep firm

 Mar  7 18:44:40 netbsd-raspa /netbsd: [   9.1275860] urtwn0:
 autoconfiguration error: timeout waiting for firmware readinessMar  7
 18:44:40 netbsd-raspa /netbsd: [  10.0384860] urtwn0: autoconfiguration
 error: timeout waiting for firmware readinessMar  7 19:00:04 netbsd-raspa
 /netbsd: [   1.0000000] /soc/firmware at simplebus1 not configured
                     Mar  7 19:00:04 netbsd-raspa /netbsd: [   9.0872570]
 urtwn0: autoconfiguration error: timeout waiting for firmware readinessMar
  7 19:00:04 netbsd-raspa /netbsd: [   9.9782020] urtwn0: autoconfiguration
 error: timeout waiting for firmware readinessMar  7 19:15:28 netbsd-raspa
 /netbsd: [   1.0000000] /soc/firmware at simplebus1 not configured
                     Mar  7 19:15:28 netbsd-raspa /netbsd: [   9.1372840]
 urtwn0: autoconfiguration error: timeout waiting for firmware readinessMar
  7 19:15:28 netbsd-raspa /netbsd: [   9.9581270] urtwn0: autoconfiguration
 error: timeout waiting for firmware readinessMar  7 19:30:52 netbsd-raspa
 /netbsd: [   1.0000000] /soc/firmware at simplebus1 not configured
                     Mar  7 19:30:52 netbsd-raspa /netbsd: [   9.0873250]
 urtwn0: autoconfiguration error: timeout waiting for firmware readinessMar
  7 19:30:52 netbsd-raspa /netbsd: [   9.9982810] urtwn0: autoconfiguration
 error: timeout waiting for firmware readinessMar  7 19:46:16 netbsd-raspa
 /netbsd: [   1.0000000] /soc/firmware at simplebus1 not configured
                     Mar  7 19:46:16 netbsd-raspa /netbsd: [   9.0172810]
 urtwn0: autoconfiguration error: timeout waiting for firmware readinessMar
  7 19:46:16 netbsd-raspa /netbsd: [   9.8881610] urtwn0: autoconfiguration
 error: timeout waiting for firmware readinessnetbsd-raspa#

 Some errors including wpa_supplicant messages:

 Mar  7 19:55:12 netbsd-raspa wpa_supplicant[294]: ioctl[SIOCS80211, op=3D23=
 ,
 val=3D0, arg_len=3D0]: Invalid argument              Mar  7 19:55:12
 netbsd-raspa wpa_supplicant[294]: urtwn0: CTRL-EVENT-SCAN-FAILED ret=3D-1
 retry=3D1                             Mar  7 19:55:13 netbsd-raspa
 wpa_supplicant[294]: ioctl[SIOCS80211, op=3D23, val=3D0, arg_len=3D0]: Inva=
 lid
 argument              Mar  7 19:55:13 netbsd-raspa wpa_supplicant[294]:
 urtwn0: CTRL-EVENT-SCAN-FAILED ret=3D-1 retry=3D1
 Mar  7 19:55:14 netbsd-raspa wpa_supplicant[294]: ioctl[SIOCS80211, op=3D23=
 ,
 val=3D0, arg_len=3D0]: Invalid argument              Mar  7 19:55:14
 netbsd-raspa wpa_supplicant[294]: urtwn0: CTRL-EVENT-SCAN-FAILED ret=3D-1
 retry=3D1                             Mar  7 19:55:15 netbsd-raspa
 wpa_supplicant[294]: ioctl[SIOCS80211, op=3D23, val=3D0, arg_len=3D0]: Inva=
 lid
 argument              Mar  7 19:55:15 netbsd-raspa wpa_supplicant[294]:
 urtwn0: CTRL-EVENT-SCAN-FAILED ret=3D-1 retry=3D1
 Mar  7 19:55:16 netbsd-raspa wpa_supplicant[294]: ioctl[SIOCS80211, op=3D23=
 ,
 val



 Finally, I removed the power supply and system rebooted once more, this
 time with network ok.

 What could it happen? WIFI dongle got crazy?What is the difference between
 a #reboot and a full restart after removing the voltage supply?

 Thanks so much
 Ramiro

 --000000000000d5a70e06132161aa
 Content-Type: text/html; charset="UTF-8"
 Content-Transfer-Encoding: quoted-printable

 <br><br>El domingo, 3 de marzo de 2024, Michael van Elst &lt;<a href=3D"mai=
 lto:mlelstv@serpens.de">mlelstv@serpens.de</a>&gt; escribi=C3=B3:<br>&gt; T=
 he following reply was made to PR kern/57992; it has been noted by GNATS.<b=
 r>&gt;<br>&gt; From: <a href=3D"mailto:mlelstv@serpens.de">mlelstv@serpens.=
 de</a> (Michael van Elst)<br>&gt; To: <a href=3D"mailto:gnats-bugs@netbsd.o=
 rg">gnats-bugs@netbsd.org</a><br>&gt; Cc:<br>&gt; Subject: Re: kern/57992: =
 urtwn (and athn) driver lost network when WIFI router changes channel<br>&g=
 t; Date: Sun, 3 Mar 2024 13:29:58 -0000 (UTC)<br>&gt;<br>&gt; =C2=A0<a href=
 =3D"mailto:ea1abz@gmail.com">ea1abz@gmail.com</a> writes:<br>&gt;<br>&gt; =
 =C2=A0&gt;If I force a channel change in the router, the network is lost an=
 d I cannot recover it. &quot;service wpa_supplicant restart&quot; does not =
 recover network. &quot;ifconfig urtwn0 down&quot; and up does not fix it.<b=
 r>&gt;<br>&gt; =C2=A0While I can confirm that a channel change isn&#39;t re=
 cognized with urtwn(4),<br>&gt; =C2=A0a restart of wpa_supplicant (or just =
 a &quot;scan&quot; request from wpa_cli)<br>&gt; =C2=A0causes a new scan an=
 d association with the network.<br>&gt;<br>&gt; =C2=A0An attempt to enable =
 automatic scanning using the roaming options<br>&gt; =C2=A0(e.g. bgscan) in=
  wpa_supplicant.conf didn&#39;t help.<br>&gt;<br>&gt; =C2=A0N.B. The same e=
 xperiment with iwm(4) causes a disconnect as soon as the<br>&gt; =C2=A0acce=
 ss point switches channels and an immediate scan, but afterwards<br>&gt; =
 =C2=A0the scan results are always truncated and the network is never found.=
 <br><br>&gt; =C2=A0Only a reboot recovers iwm(4) from this state.<br>&gt;<b=
 r>&gt;<br>Thanks Michael for sharing your experience.<br><br>Yesterday I fa=
 ced a new scenario. My raspberry pi zero w for unknown reason lost the netw=
 ork. <br><br>My rebooting script detected it and rebooted the system but ne=
 twork did not recover. I connected the TV and I see that the system reboote=
 d several times but network did no work. Each reboot spaced 15minutes cause=
  my rebooting script used 3 ping retries at 5min intervals:<br><br>netbsd-r=
 aspa# zcat /var/log/messages.0.gz|grep firm<br><br>Mar =C2=A07 18:44:40 net=
 bsd-raspa /netbsd: [ =C2=A0 9.1275860] urtwn0: autoconfiguration error: tim=
 eout waiting for firmware readinessMar =C2=A07 18:44:40 netbsd-raspa /netbs=
 d: [ =C2=A010.0384860] urtwn0: autoconfiguration error: timeout waiting for=
  firmware readinessMar =C2=A07 19:00:04 netbsd-raspa /netbsd: [ =C2=A0 1.00=
 00000] /soc/firmware at simplebus1 not configured =C2=A0 =C2=A0 =C2=A0 =C2=
 =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 M=
 ar =C2=A07 19:00:04 netbsd-raspa /netbsd: [ =C2=A0 9.0872570] urtwn0: autoc=
 onfiguration error: timeout waiting for firmware readinessMar =C2=A07 19:00=
 :04 netbsd-raspa /netbsd: [ =C2=A0 9.9782020] urtwn0: autoconfiguration err=
 or: timeout waiting for firmware readinessMar =C2=A07 19:15:28 netbsd-raspa=
  /netbsd: [ =C2=A0 1.0000000] /soc/firmware at simplebus1 not configured =
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
 =A0 =C2=A0 =C2=A0 =C2=A0 Mar =C2=A07 19:15:28 netbsd-raspa /netbsd: [ =C2=
 =A0 9.1372840] urtwn0: autoconfiguration error: timeout waiting for firmwar=
 e readinessMar =C2=A07 19:15:28 netbsd-raspa /netbsd: [ =C2=A0 9.9581270] u=
 rtwn0: autoconfiguration error: timeout waiting for firmware readinessMar =
 =C2=A07 19:30:52 netbsd-raspa /netbsd: [ =C2=A0 1.0000000] /soc/firmware at=
  simplebus1 not configured =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
  =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Mar =C2=A07 19:30:52 netb=
 sd-raspa /netbsd: [ =C2=A0 9.0873250] urtwn0: autoconfiguration error: time=
 out waiting for firmware readinessMar =C2=A07 19:30:52 netbsd-raspa /netbsd=
 : [ =C2=A0 9.9982810] urtwn0: autoconfiguration error: timeout waiting for =
 firmware readinessMar =C2=A07 19:46:16 netbsd-raspa /netbsd: [ =C2=A0 1.000=
 0000] /soc/firmware at simplebus1 not configured =C2=A0 =C2=A0 =C2=A0 =C2=
 =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 M=
 ar =C2=A07 19:46:16 netbsd-raspa /netbsd: [ =C2=A0 9.0172810] urtwn0: autoc=
 onfiguration error: timeout waiting for firmware readinessMar =C2=A07 19:46=
 :16 netbsd-raspa /netbsd: [ =C2=A0 9.8881610] urtwn0: autoconfiguration err=
 or: timeout waiting for firmware readinessnetbsd-raspa#<br><br>Some errors =
 including wpa_supplicant messages:<br><br>Mar =C2=A07 19:55:12 netbsd-raspa=
  wpa_supplicant[294]: ioctl[SIOCS80211, op=3D23, val=3D0, arg_len=3D0]: Inv=
 alid argument =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Mar =C2=A07 1=
 9:55:12 netbsd-raspa wpa_supplicant[294]: urtwn0: CTRL-EVENT-SCAN-FAILED re=
 t=3D-1 retry=3D1 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Mar =C2=A07 19:55:13 netbsd-raspa=
  wpa_supplicant[294]: ioctl[SIOCS80211, op=3D23, val=3D0, arg_len=3D0]: Inv=
 alid argument =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Mar =C2=A07 1=
 9:55:13 netbsd-raspa wpa_supplicant[294]: urtwn0: CTRL-EVENT-SCAN-FAILED re=
 t=3D-1 retry=3D1 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Mar =C2=A07 19:55:14 netbsd-raspa=
  wpa_supplicant[294]: ioctl[SIOCS80211, op=3D23, val=3D0, arg_len=3D0]: Inv=
 alid argument =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Mar =C2=A07 1=
 9:55:14 netbsd-raspa wpa_supplicant[294]: urtwn0: CTRL-EVENT-SCAN-FAILED re=
 t=3D-1 retry=3D1 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Mar =C2=A07 19:55:15 netbsd-raspa=
  wpa_supplicant[294]: ioctl[SIOCS80211, op=3D23, val=3D0, arg_len=3D0]: Inv=
 alid argument =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Mar =C2=A07 1=
 9:55:15 netbsd-raspa wpa_supplicant[294]: urtwn0: CTRL-EVENT-SCAN-FAILED re=
 t=3D-1 retry=3D1 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Mar =C2=A07 19:55:16 netbsd-raspa=
  wpa_supplicant[294]: ioctl[SIOCS80211, op=3D23, val<br><br><br><br>Finally=
 , I removed the power supply and system rebooted once more, this time with =
 network ok.<br><br>What could it happen? WIFI dongle got crazy?What is the =
 difference between a #reboot and a full restart after removing the voltage =
 supply?<br><br>Thanks so much<br> Ramiro<br><br><br>

 --000000000000d5a70e06132161aa--

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.