[CM-662] Incorrect passphrase not handled correctly Created: 06/Aug/14 Updated: 09/Sep/14 Resolved: 12/Aug/14 Status: Project: Component/s: Affects Version/s: Fix Version/s: Closed Connection Manager ConnMan Core None Type: Reporter: Resolution: Labels: Remaining Estimate: Time Spent: Original Estimate: Environment: Bug Liu Jonathan Fixed None Not Specified Testability: Yes None Priority: Assignee: Votes: Undecided Flykt Patrik 0 Not Specified Not Specified Arch Linux 64-bit Description When connmanctl agent prompts for a passphrase while connecting to a WPA2-PSK protected network, entering the wrong passphrase twice drops you to the connmanctl prompt. Trying to connect again results in "In progress" error. This occurs with connman 1.24 and 72e76f780c574aded82b5a9c5355e545c3740784 from git. Tested with 2 different USB wireless adapters with same result. # connmanctl connmanctl> agent on Agent registered connmanctl> enable wifi Enabled wifi connmanctl> scan wifi Scan completed for wifi connmanctl> connect wifi_123456789abc_0123456789abcdef_managed_psk Agent RequestInput wifi_123456789abc_0123456789abcdef_managed_psk Passphrase = [ Type=psk, Requirement=mandatory ] Passphrase? wrong Agent ReportError wifi_123456789abc_0123456789abcdef_managed_psk invalid-key connmanctl> Retry (yes/no)? y Agent RequestInput wifi_123456789abc_0123456789abcdef_managed_psk Passphrase = [ Type=psk, Requirement=mandatory ] Passphrase? wrong connmanctl> connmanctl> connect wifi_123456789abc_0123456789abcdef_managed_psk Error /net/connman/service/wifi_123456789abc_0123456789abcdef_managed_psk: In progress connmanctl> connect wifi_123456789abc_0123456789abcdef_managed_psk Error /net/connman/service/wifi_123456789abc_0123456789abcdef_managed_psk: In progress connmanctl> disconnect wifi_123456789abc_0123456789abcdef_managed_psk Error /net/connman/service/wifi_123456789abc_0123456789abcdef_managed_psk: Operation aborted Error /net/connman/service/wifi_123456789abc_0123456789abcdef_managed_psk: Not connected connmanctl> connect wifi_123456789abc_0123456789abcdef_managed_psk Agent RequestInput wifi_123456789abc_0123456789abcdef_managed_psk Passphrase = [ Type=psk, Requirement=mandatory ] Passphrase? wrong connmanctl> connect wifi_123456789abc_0123456789abcdef_managed_psk Error /net/connman/service/wifi_123456789abc_0123456789abcdef_managed_psk: In progress Note that after disconnecting and trying to connect again, it doesn't show any error when the wrong passphrase is entered. Also, answering no for Retry results in "Input/output error". # connmanctl connmanctl> disable wifi Disabled wifi connmanctl> agent on Agent registered connmanctl> enable wifi Enabled wifi connmanctl> scan wifi Scan completed for wifi connmanctl> connect wifi_123456789abc_0123456789abcdef_managed_psk Agent RequestInput wifi_123456789abc_0123456789abcdef_managed_psk Passphrase = [ Type=psk, Requirement=mandatory ] Passphrase? wrong Agent ReportError wifi_123456789abc_0123456789abcdef_managed_psk invalid-key connmanctl> Retry (yes/no)? n Error /net/connman/service/wifi_123456789abc_0123456789abcdef_managed_psk: Input/output error Comments Comment by Flykt Patrik [ 06/Aug/14 ] If ConnMan is connecting a service, the next one trying to connect the same service will be returned an 'In progress' error. So the sequence below is to be expected: connmanctl> connect wifi_123456789abc_0123456789abcdef_managed_psk ... connmanctl> connect wifi_123456789abc_0123456789abcdef_managed_psk Error /net/connman/service/wifi_123456789abc_0123456789abcdef_managed_psk: In progress Note that 'In progress' is returned even though it's the same process/D-Bus client that is rerequesting a connection. As the second Connect() method call will also need a reply, the only easy solution is to return 'In progress' no matter which client issued the initial connect. Note that in the above sequence the first call to Connect() is still ongoing as connmanctl is fully asynchronous! connmanctl> disconnect wifi_123456789abc_0123456789abcdef_managed_psk Error /net/connman/service/wifi_123456789abc_0123456789abcdef_managed_psk: Operation aborted Error /net/connman/service/wifi_123456789abc_0123456789abcdef_managed_psk: Not connected When a Disconnect() is sent, the still pending Connect() receives 'Operation aborted' as the Connect() was terminated. The 'Not connected' is a reply to the Disconnect() call as the service was not yet properly connected in the first place... connmanctl> Retry (yes/no)? n Error /net/connman/service/wifi_123456789abc_0123456789abcdef_managed_psk: Input/output error The 'Input/output' error tries to signal that the UI/user was not able to supply a passphrase, thus it was something different than a network error that caused the service not to connect. In order not to be confused, ConnMan always sends an error back if the operation did not complete successfully. Meanwhile the Agent can be asked for passphrases and whether to retry or not, multiple times. Comment by Flykt Patrik [ 06/Aug/14 ] Works as expected. May be somewhat confusing as everything is asynchronous. Comment by Liu Jonathan [ 07/Aug/14 ] It seems to just stay in "In progress" after entering wrong passphrase. Eventually I get "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken." The passphrase fails immediately because "wrong" is too short for a WPA2-PSK passphrase, whereas "wrongwrongwrong" will actually try to associate with the AP. "wrongwrongwrong" fails after some amount of seconds. but after second attempt I get same error "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken." Comment by Liu Jonathan [ 07/Aug/14 ] If passphrase is incorrect, it should keep asking unless the user cancels. The access point is a DrayTek Vigor2710n Wireless ADSL2+ Router. Wireless USB adapters tested: Ralink Technology, Corp. RT5370 Wireless Adapter, Realtek Semiconductor Corp. RTL8187 Wireless Adapter. Comment by Flykt Patrik [ 08/Aug/14 ] Yes, this is a bug in ConnMan. Thanks for the clarification here and on the IRC channel. Comment by Liu Jonathan [ 10/Aug/14 ] I have tested the patch on the mailing list. It fixes answering "y" to retry entering the passphrase repeatedly. If you answer "n" for "Retry (yes/no)?" prompt, wait a while and try connecting again, you still get "In progress" error. # connmanctl connmanctl> agent on Agent registered connmanctl> enable wifi Enabled wifi connmanctl> scan wifi Scan completed for wifi connmanctl> connect wifi_123456789abc_0123456789abcdef_managed_psk Agent RequestInput wifi_123456789abc_0123456789abcdef_managed_psk Passphrase = [ Type=psk, Requirement=mandatory ] Passphrase? wrong Agent ReportError wifi_123456789abc_0123456789abcdef_managed_psk invalid-key connmanctl> Retry (yes/no)? n Error /net/connman/service/wifi_123456789abc_0123456789abcdef_managed_psk: Input/output error connmanctl> connect wifi_123456789abc_0123456789abcdef_managed_psk Agent RequestInput wifi_123456789abc_0123456789abcdef_managed_psk Passphrase = [ Type=psk, Requirement=mandatory ] Passphrase? wrong (wait 10 seconds) connmanctl> connmanctl> connect wifi_123456789abc_0123456789abcdef_managed_psk Error /net/connman/service/wifi_123456789abc_0123456789abcdef_managed_psk: In progress connmanctl> (wait a few minutes) Error /net/connman/service/wifi_123456789abc_0123456789abcdef_managed_psk: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken. connmanctl> Comment by Flykt Patrik [ 12/Aug/14 ] Fixed by commits 127d216001076d2b73a352a019f00d49bae30835 and 6b70c54a69dfe670eba8c5d3d43ecf24be0e1e51 Generated at Tue Feb 09 17:15:06 PST 2016 using JIRA 6.3.14#6345sha1:47b2bb0a76c6e60bffb16fa45719b26a7e5e0c78.