On Sun, Jan 01, 2023 at 10:37:44PM +0000, Ali Farzanrad wrote:
> OK, I started in a working state where I was connected to my Android
> phone:

OK, let's untangle this... see below...

> # cat /etc/hostname.athn0
> nwid [..name..] wpakey [..pass..]
> inet autoconf

Before you get to "status: active" the interface was scanning for APs.
While scanning, it did already behave just as you describe below...

> # ifconfig athn0
> athn0: flags=808843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,AUTOCONF4> mtu 1500
>       lladdr [..lladdr..]
>       index 1 priority 4 llprio 3
>       groups: wlan egress
>       media: IEEE802.11 autoselect (HT-MCS7 mode 11n)
>       status: active
>       ieee80211: nwid [..name..] chan 9 bssid [..bssid..] -45dBm wpakey 
> wpaprotos wpa2 wpaakms psk wpaciphers ccmp wpagroupcipher ccmp
>       inet 192.168.131.83 netmask 0xffffff00 broadcast 192.168.131.255
> 
> then I simply re-run netstart:
> 
> # sh /etc/netstart athn0
> # ifconfig athn0
> athn0: flags=808843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,AUTOCONF4> mtu 1500
>       lladdr [..lladdr..]
>       index 1 priority 4 llprio 3
>       groups: wlan egress
>       media: IEEE802.11 autoselect (DS1 mode 11b)
>       status: no network

... here.

The interface is not connected to any AP (status: no network) so it will
keep scanning. While scanning, the interface will switch between modes,
because the 11b/g and 11a bands require separate sets of channels to
be scanned. To implement switching between channel sets the net80211 stack
will keep switching modes internally. This shows up on the ifconfig media
line as a side-effect. But this unrelated to Tx rates used for data frames
because no data frames will even be sent before the interface is associated.

So now, you are in 11b mode and scanning...

>       ieee80211: nwid [..name..] wpakey wpaprotos wpa2 wpaakms psk wpaciphers 
> ccmp wpagroupcipher ccmp
>       inet 192.168.131.83 netmask 0xffffff00 broadcast 192.168.131.255
> 
> [..after some time..]
> 
> # ifconfig athn0
> athn0: flags=808843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,AUTOCONF4> mtu 1500
>       lladdr [..lladdr..]
>       index 1 priority 4 llprio 3
>       groups: wlan egress
>       media: IEEE802.11 autoselect (DS1 mode 11g)
>       status: no network

... and here, you are in 11g mode, but still not associated, sill scanning.

The real problem is that your AP seems to be disappearing.
Your phone might be switching between WLAN channels, or it might be
turning the AP off for some reason. In either case the AP will have
disappeared from the client's point of view.

You could try:
        ifconfig athn0 debug
        tail -f /var/log/messages

Hopefully the additional debug info now written to /var/log/messages will
help you figure out why the AP is not being seen anymore.

>       ieee80211: nwid [..name..] chan 9 bssid [..bssid..] -100dBm wpakey 
> wpaprotos wpa2 wpaakms psk wpaciphers ccmp wpagroupcipher ccmp
>       inet 192.168.131.83 netmask 0xffffff00 broadcast 192.168.131.255
> 
> [..after some time..]
> 
> # ifconfig athn0
> athn0: flags=808843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,AUTOCONF4> mtu 1500
>       lladdr [..lladdr..]
>       index 1 priority 4 llprio 3
>       groups: wlan egress
>       media: IEEE802.11 autoselect (DS1)
>       status: no network
>       ieee80211: nwid [..name..] wpakey wpaprotos wpa2 wpaakms psk wpaciphers 
> ccmp wpagroupcipher ccmp
>       inet 192.168.131.83 netmask 0xffffff00 broadcast 192.168.131.255
> 
> and it repeats showing different modes but always in DS1 media type.
> 2 days ago I waited for hours, but it didn't find correct media type.
> This time even after reboot it didn't find correct media type, so I
> forced to turn my phone's Internet sharing off and on.
> 
> I wanted to find the problem by myself but unfortunately I don't know
> how :(
> 

Reply via email to