Networks with same SSID and different authTypes are not handled correctly
digaus opened this issue · comments
Prerequisites
Check all boxes if you have done the following:
- Checked that your issue isn't already filed: https://github.com/tripflex/wifiwizard2/issues
- Make sure you fill out the Issue Type below
Issue type
Select all that apply
- Bug
- Enhancement
- Task
- Question
- Other
Description
I have a network which once was protected with WPA. Then I changed the network to open and tried to connect to it with this plugin. The plugin then thinks the network is already configured and tries to connect to it with the available id. This however is wrong as the id is from the network with the same SSID but with WPA. These should be handled as two different networks.
Steps to Reproduce
- Create network with WPA and connect to it
- Change network to open
- Try to connect to it with this plugin
Expected behavior:
Should connect successfully as it should be handled as a different network
Actual behavior:
Trys to connect to the network with WPA
Reproduces how often:
100%
Versions
cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.0.0
Cordova Plugins : cordova-plugin-wifiwizard2 git+https://github.com/tripflex/wifiwizard2.git,
Another app manages to handle this case correctly...
Maybe you should also check the groupCiphers.
private static String getSecurity(final WifiConfiguration network) {
if(network.allowedGroupCiphers.get(GroupCipher.CCMP)) {
return "WPA2";
}
else if(network.allowedGroupCiphers.get(GroupCipher.TKIP)) {
return "WPA";
}
else if(network.allowedGroupCiphers.get(GroupCipher.WEP40)
|| network.allowedGroupCiphers.get(GroupCipher.WEP104)) {
return "WEP";
}
else return "NONE";
}
Implemented a possible solution here:
https://github.com/digaus/WifiWizard2
Tested with my usecase where it works. Should be tested more. Basically solution is to also check for authType when doing stuff with the WifiConfiguration based on the SSID.
@digaus thanks for reporting this, i can confirm this would be an issue, would you mind submitting a pull request with your changes so we can review them and merge them into the plugin for release in the next update?