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

Needs changes for Android 10 (Lineage 17) #6

Closed
matthijskooijman opened this issue May 17, 2021 · 5 comments
Closed

Needs changes for Android 10 (Lineage 17) #6

matthijskooijman opened this issue May 17, 2021 · 5 comments
Assignees
Labels
question Further information is requested

Comments

@matthijskooijman
Copy link

I tried your script today to import a wpa_supplicant.conf from Android 7 (Fairphone Open OS) into Android 10 (Lineage 17.1), but it needed some changes to work. In the hope that this might benefit others, I'm documenting what I did here.

Without changes, the produced file produces the following logcat warning:

05-17 19:59:18.227   749  2676 E WifiConfigManager: XML deserialization of store failed. All saved networks are lost!
05-17 19:59:18.227   749  2676 E WifiConfigManager: org.xmlpull.v1.XmlPullParserException: Configuration key does not match. Retrieved: "Jodocus"-WPA_PSK, Calculated: "Jodocus"WPA_PSK

Comparing the system-generated file with the script-generated file confirms that there should not be a dash between the SSID and the keymgmt. Other changes are the file version number (1 vs 3), but that does not seem to matter, Android autobumps it. And some of the Allowed fields have a few more bits in the script-generated version (probably because the script allows everything by default). However, the AllowedProtocols field does seem to cause a problem:

05-17 20:04:17.656   741  2710 E SupplicantStaIfaceHal: java.lang.IllegalArgumentException: Invalid protoMask bit in wificonfig: 3

Bit 3 is WAPI, I suspect Android 10 does not support it anymore (here is also some docs with the WAPI value grayed out). Unsetting that bit, fixes the error.

With the changes below, I managed to import 63 of my networks (one failed, but that one is a bit weird in wpa_supplication.conf).

--- a/convert_wifi.pl
+++ b/convert_wifi.pl
@@ -77,8 +77,8 @@ ()
        #   9 OWE - Opportunististic Wireless Encryption
        #   10 SUITE_B_192
 
-       #my $AllowedProtocols = '03'; # WPA1+WPA2
-       my $AllowedProtocols = '0b'; # WPA1+WPA2+WAPI
+       my $AllowedProtocols = '03'; # WPA1+WPA2
+       #my $AllowedProtocols = '0b'; # WPA1+WPA2+WAPI
        # https://developer.android.com/reference/android/net/wifi/WifiConfiguration.Protocol
        #   0 WPA1 (deprecated)
        #   1 RSN WPA2/WPA3/IEEE 802.11i
@@ -147,7 +147,7 @@ ()
        }
 
        $SSID = quote_xml $SSID;
-       my $ConfigKey = "${SSID}-$key_mgmt";
+       my $ConfigKey = "${SSID}$key_mgmt";
        my $priority = $CUR{priority} || 0;
        
        # output main config block with all variables filled-in
@mnalis mnalis self-assigned this May 24, 2021
@mnalis
Copy link
Owner

mnalis commented May 24, 2021

thanks @matthijskooijman for the report!

ConfigKey conflicts with a6db434 and AllowedProtocols with b540f44 from PR #5 by @jimklimov

@jimklimov can you share what Android version and phone model you use? Obviously what works for one fails for other and vice versa, so I'd like to at least document it in readme (or maybe add options to select which to use).

@mnalis mnalis added the question Further information is requested label May 24, 2021
@mnalis
Copy link
Owner

mnalis commented Jun 6, 2021

For now I've documented it and created a new wapi git branch, and reverted those two changes in master.
If I get more information about what OS version require WAPI support, I'll update and maybe make it a config option.
Thanks for your report!

@mnalis mnalis closed this as completed in 848df44 Jun 6, 2021
@Hodapp87
Copy link

I see this issue is closed, but figured I'd add a note here: I am on Android 11 & LIneageOS and master appeared to work fine here.

@ildar
Copy link

ildar commented May 20, 2022

BTW the file location changed to /data/misc/apexdata/com.android.wifi in recent Androids. Plz add to the README

mnalis added a commit that referenced this issue May 20, 2022
note the alternative location for WifiConfigStore.xml
as reported in #6 (comment)
@mnalis
Copy link
Owner

mnalis commented May 20, 2022

@ildar thanks, added

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

No branches or pull requests

4 participants