WifiWizard2 icon indicating copy to clipboard operation
WifiWizard2 copied to clipboard

Networks with same SSID and different authTypes are not handled correctly

Open digaus opened this issue 6 years ago • 4 comments
trafficstars

Prerequisites

Check all boxes if you have done the following:

  • [x] Checked that your issue isn't already filed: https://github.com/tripflex/wifiwizard2/issues
  • [x] Make sure you fill out the Issue Type below

Issue type

Select all that apply

  • [x] 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.

https://github.com/tripflex/WifiWizard2/blob/e38a73472c080bb9ebbce7eb519f40b820e9e949/src/android/wifiwizard2/WifiWizard2.java#L1216

Steps to Reproduce

  1. Create network with WPA and connect to it
  2. Change network to open
  3. 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 ([email protected])
 Cordova Platforms     : android 8.0.0
 Cordova Plugins       : cordova-plugin-wifiwizard2 git+https://github.com/tripflex/wifiwizard2.git,

digaus avatar Apr 17 '19 09:04 digaus

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";
}

digaus avatar Apr 17 '19 10:04 digaus

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 avatar Apr 17 '19 13:04 digaus

@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?

tripflex avatar Jun 23 '19 21:06 tripflex

@tripflex Will do when I find the time :)

digaus avatar Jul 18 '19 22:07 digaus