Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update frequency parsing for iw 6.7 compatibility #367

Merged
merged 3 commits into from Dec 30, 2023
Merged

Update frequency parsing for iw 6.7 compatibility #367

merged 3 commits into from Dec 30, 2023

Conversation

joanbm
Copy link
Contributor

@joanbm joanbm commented Dec 23, 2023

Since iw 6.7, which adds 802.11ah support, iw may print fractional frequencies (e.g. 917.4 MHz). The change in the formatting code can also affect frequencies in the 2.4 and 5 GHz bands, so a frequency that used to be shown as "2412 MHz" may now be shown as "2412.0 MHz".

This breaks the parsing logic in can_transmit_to_channel, ieee80211_frequency_to_channel and is_5ghz_frequency.

The problem in can_transmit_to_channel causes an error when creating an AP, due the frequency not being detected as supported ("ERROR: Your adapter can not transmit to channel 1, frequency band 2.4GHz.").

Fix this by changing the parsing logic to accept a trailing ".0" (or even ".00", etc.) suffix for the existing 2.4 and 5 GHz bands.

See also:

The PR also syncs the definition of ieee80211_frequency_to_channel with the latest iw release and fixes a minor mistake in a text message.

Since iw 6.7, which adds 802.11ah support, iw may print fractional
frequencies (e.g. 917.4 MHz). The change in the formatting code can
also affect frequencies in the 2.4 and 5 GHz bands, so a frequency
that used to be shown as "2412 MHz" may now be shown as "2412.0 MHz".

This breaks the parsing logic in `can_transmit_to_channel`,
`ieee80211_frequency_to_channel` and `is_5ghz_frequency`.
The problem in `can_transmit_to_channel` causes an error when creating
an AP, due the frequency not being detected as supported ("ERROR:
Your adapter can not transmit to channel 1, frequency band 2.4GHz.").

Fix this by changing the parsing logic to accept a trailing ".0"
(or even ".00", etc.) suffix for the existing 2.4 and 5 GHz bands.

See also: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git/commit/?id=f2d9f5b52677f5414dc194be94b5916d2b080eab
          https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git/commit/?id=e2224c729840cc33c6ea89ba5e91b69f79c88e85
          https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git/commit/?id=1bc6ab0abbb6f26f35d826d166d06bc28ae47b6b
Make sure the definition of `ieee80211_frequency_to_channel` matches
with the latest changes from iw. Probably not very useful since all
changes seem related to 6GHz / 60GHz / 802.11ah support, which as far
as I can tell create_ap does not yet support.

See also: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git/commit/?id=43789196906376cc108ed06b4a3175d767586cd3
          https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git/commit/?id=b12fc8a84480d25ea791f0dff8cb92d69098c91c
          https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git/commit/?id=f2d9f5b52677f5414dc194be94b5916d2b080eab
@niksingh710
Copy link

@joanbm I am unsure but recently after updating my system I am facing this error

ERROR: Your adapter can not transmit to channel 1, frequency band 2.4GHz.

does this pr resolves that?

@joanbm
Copy link
Contributor Author

joanbm commented Dec 28, 2023

@niksingh710 Yes, most likely. You probably have iw 6.7 (check iw --version), Arch Linux has it on their non-testing repositories already.

@niksingh710
Copy link

@niksingh710 Yes, most likely. You probably have iw 6.7 (check iw --version), Arch Linux has it on their non-testing repositories already.

yep iw --version giving 6.7

@akshettrj
Copy link

I tried your branch and it seems to work for 2.4 GHz frequency but not for 5GHz... Although I think 5GHz did not work for me in the past as well

@joanbm
Copy link
Contributor Author

joanbm commented Dec 29, 2023

I tried your branch and it seems to work for 2.4 GHz frequency but not for 5GHz... Although I think 5GHz did not work for me in the past as well

Hmm, unfortunately I don't have a 5GHz device around me right now to test it, but I can't see why it wouldn't work (provided it has in the past, that is).

@akshettrj
Copy link

akshettrj commented Dec 29, 2023

Sorry, I was using wrong channels, it did work for 5GHz as well for me. My bad 😅

@lakinduakash
Copy link
Owner

Thanks for your contribution? Is it backward compatible for previous iw versions?

@joanbm
Copy link
Contributor Author

joanbm commented Dec 30, 2023

Is it backward compatible for previous iw versions?

Yes, the changes in the regular expressions are optional (note the ? at the end of the decimal specifier) and I also did a small test with iw 5.9 just in case.

Repository owner deleted a comment from awenbober Dec 30, 2023
@lakinduakash
Copy link
Owner

Awesome! At the moment i don't have ubuntu machine to test. Thanks for testing and much appreciated.

@lakinduakash lakinduakash merged commit 2dc1649 into lakinduakash:master Dec 30, 2023
1 check passed
@niksingh710
Copy link

quite curious as last release was in nov and this pr fixes a bug introduced after the kernel release when will be the next release as arch does not have any -git package.

@joanbm
Copy link
Contributor Author

joanbm commented Dec 31, 2023

quite curious as last release was in nov and this pr fixes a bug introduced after the kernel release when will be the next release as arch does not have any -git package.

FWIW the AUR package has a new pkgrel which already includes this patch (even though it’s not included in an official release yet) - see https://aur.archlinux.org/cgit/aur.git/commit/?h=linux-wifi-hotspot&id=08e15671e46e6182d8df7c631ba119bea40c1a99

@niksingh710
Copy link

Thanks, buddy wasn't aware of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants