ok: autoconnect after boot; nok: passphrase-request
Not an expert on iwd debugging, but a few interesting things:
1. regulatory domain is set after the scan is triggered in the "nok" version, and before in the "ok" version. not sure if that matters.
2. the "nok" version seems to have been disconnected and reconnected, no idea why but this section is different (this appears to be the reconnect, work item 3 was the original connect attempt, then it moves on to work item 4 & 5 to retry).
wiphy.c:wiphy_radio_work_done() Work item 3 done
station.c:station_connect_cb() 3, result: 2
station.c:station_reset_connection_state() 3
station.c:station_roam_state_clear() 3
station.c:station_enter_state() Old State: connecting, new state: disconnected
station.c:station_enter_state() Old State: disconnected, new state: autoconnect_quick
scan.c:scan_periodic_start() Starting periodic scan for wdev 1
wiphy.c:wiphy_radio_work_insert() Inserting work item 4
wiphy.c:wiphy_radio_work_next() Starting work item 4
scan.c:scan_notify() Scan notification Trigger Scan(33)
scan.c:scan_request_triggered() Passive scan triggered for wdev 1
scan.c:scan_periodic_triggered() Periodic scan triggered for wdev 1
station.c:station_dbus_disconnect()
station.c:station_enter_state() Old State: autoconnect_full, new state: disconnected
scan.c:scan_periodic_stop() Stopping periodic scan for wdev 1
scan.c:scan_cancel() Trying to cancel scan id 4 for wdev 1
scan.c:scan_cancel() Scan has been triggered, wait for it to complete
scan.c:scan_notify() Scan notification New Scan Results(34)
wiphy.c:wiphy_radio_work_done() Work item 4 done
netdev.c:netdev_link_notify() event 16 on ifindex 3
network.c:network_connect()
network.c:network_connect_psk() ask_passphrase: true
agent.c:agent_request_passphrase() agent 0x15765f8 owner :1.6 path /net/connman/iwd_agent
agent.c:agent_send_next_request() send request to :1.6 /net/connman/iwd_agent
agent.c:agent_receive_reply() agent 0x15765f8 request id 33
network.c:passphrase_callback() result 0
network.c:network_generate_sae_pt() Generating PT for Group 19
network.c:network_generate_sae_pt() Generating PT for Group 20
netdev.c:netdev_cqm_rssi_update()
wiphy.c:wiphy_radio_work_insert() Inserting work item 5
wiphy.c:wiphy_radio_work_next() Starting work item 5
station.c:__station_connect_network() connecting to BSS c0:25:06:ac:e3:6a
station.c:station_enter_state() Old State: disconnected, new state: connecting
station.c:station_netdev_event() Associating
netdev.c:netdev_link_notify() event 16 on ifindex 3
netdev.c:netdev_mlme_notify() MLME notification Connect(46)
netdev.c:netdev_connect_event()
Display More
This bit below seems to always happen regardless of good/bad connects, I am guessing the way connman/iwd integrate is connman has the passphrase so it probably asks iwd to scan, then tells iwd to connect, iwd says got a connect/handshake but what's the passphrase, connman sends it. So perhaps the issue is if it went through this sequence and received a disconnect and is asked again it doesn't quite know how to handle it. Line 218 is the start of the first connect attempt, then line 255 is the second one in the "nok" file.
network.c:network_connect_psk() ask_passphrase: true
agent.c:agent_request_passphrase() agent 0x15765f8 owner :1.6 path /net/connman/iwd_agent
agent.c:agent_send_next_request() send request to :1.6 /net/connman/iwd_agent
agent.c:agent_receive_reply() agent 0x15765f8 request id 33
It's possible all of the reported invalid key situations are in fact the same problem, no idea really. It might be useful to send this over to the connman/iwd mailing lists, or wait for one of the developers and see if they have any other insight.
BTW, If you have paired connman & iwd debug logs that would probably be useful to the mailing lists exhibiting good/bad at the same time.