Hi peoples,
I am attempting to connect to a WPA2 personal access point using DHCP (TCPCONFIG 5)
Using the example, It takes up to 15 minutes for the sock_init_or_exit(1) to fail or succeed.
Once the interface does come up it does not get a DHCP address.
Does anyone have any ideas or suggestions?
Thanks
Dave
A bit more information…
After turning on the TCP_VERBOSE and WPA_VERBOSE I was able to find that the interface appears to get into an authentication loop.
Code outline…
printf("
Calling sock_init()
");
sock_init();
while (ifpending(IF_WIFI0) == IF_COMING_UP)
{
tcp_tick(NULL);
if (SEC_TIMER != stTime) {
printf("Sec_Timer = %ld
", SEC_TIMER);
stTime=SEC_TIMER;
}
}
I am printing the SEC_TIMER just to show the time taken to perform the loop
from STDIO:
Calling sock_init()
Using hexadecimal PSK
[1] Setting scan request: 100 msec
[1] Setting scan request: 100 msec
TCP: 3132ms since last call to tcp_tick!
[2] Trying to associate with 00:1e:2a:f8:3b:50 (SSID=‘dalyvid’ freq=2422 MHz)
[1] Cancelling scan request
[1] RSN: using IEEE 802.11i/D9.0
[1] Setting authentication timeout: 5000 msec
TCP: 116ms since last call to tcp_tick!
[2] Trying to associate with 00:1e:2a:f8:3b:50 (SSID=‘dalyvid’ freq=2422 MHz)
[1] Cancelling scan request
[1] RSN: using IEEE 802.11i/D9.0
[1] Setting authentication timeout: 5000 msec
[1] Associated to a new BSS: BSSID=00:1e:2a:f8:3b:50
[2] Associated with 00:1e:2a:f8:3b:50
[1] Setting authentication timeout: 10000 msec
TCP: 183ms since last call to tcp_tick!
Sec_Timer = 605176646
Sec_Timer = 605176647
Sec_Timer = 605176648
Sec_Timer = 605176649
[1] Setting scan request: 100 msec
[1] Disconnect event - remove keys
Sec_Timer = 605176650
[2] Trying to associate with 00:1e:2a:f8:3b:50 (SSID=‘dalyvid’ freq=2422 MHz)
[1] Cancelling scan request
[1] RSN: using IEEE 802.11i/D9.0
[1] Setting authentication timeout: 5000 msec
TCP: 102ms since last call to tcp_tick!
[2] Trying to associate with 00:1e:2a:f8:3b:50 (SSID=‘dalyvid’ freq=2422 MHz)
[1] Cancelling scan request
[1] RSN: using IEEE 802.11i/D9.0
[1] Setting authentication timeout: 5000 msec
[1] Associated to a new BSS: BSSID=00:1e:2a:f8:3b:50
[2] Associated with 00:1e:2a:f8:3b:50
[1] Setting authentication timeout: 10000 msec
Sec_Timer = 605176651
TCP: 214ms since last call to tcp_tick!
Sec_Timer = 605176652
Sec_Timer = 605176653
Sec_Timer = 605176654
[1] Setting scan request: 100 msec
[1] Disconnect event - remove keys
Sec_Timer = 605176655
Sec_Timer = 605176656
[2] Trying to associate with 00:1e:2a:f8:3b:50 (SSID=‘dalyvid’ freq=2422 MHz)
[1] Cancelling scan request
This goes on more quite a while in a loop…
So… why does the interface start scanning 4 seconds after setting an authentication timeout of 10 seconds… Shouldn’t it wait for that to expire?
Eventually…
[2] Associated with 00:1e:2a:f8:3b:50
[1] Setting authentication timeout: 10000 msec
TCP: 137ms since last call to tcp_tick!
Sec_Timer = 605177781
Sec_Timer = 605177782
Sec_Timer = 605177783
Sec_Timer = 605177784
[1] Setting scan request: 100 msec
[1] Disconnect event - remove keys
Sec_Timer = 605177785
[2] Trying to associate with 00:1e:2a:f8:3b:50 (SSID=‘dalyvid’ freq=2422 MHz)
[1] Cancelling scan request
[1] RSN: using IEEE 802.11i/D9.0
[1] Setting authentication timeout: 5000 msec
[2] Trying to associate with 00:1e:2a:f8:3b:50 (SSID=‘dalyvid’ freq=2422 MHz)
[1] Cancelling scan request
[1] RSN: using IEEE 802.11i/D9.0
[1] Setting authentication timeout: 5000 msec
[1] Associated to a new BSS: BSSID=00:1e:2a:f8:3b:50
[2] Associated with 00:1e:2a:f8:3b:50
[1] Setting authentication timeout: 10000 msec
Sec_Timer = 605177786
TCP: 154ms since last call to tcp_tick!
Sec_Timer = 605177787
[1] Setting authentication timeout: 10000 msec
Sec_Timer = 605177788
Sec_Timer = 605177789
Sec_Timer = 605177790
[2] WPA: Key negotiation completed with 00:1e:2a:f8:3b:50
[1] Cancelling authentication timeout
Sec_Timer = 605177791
Finished sock_init()
So after (605177791 - 605176646 = ) 1145 Seconds (or 19 minutes )
We are associated and authenticated… I suspect this should be quicker… yeah??
So, I eventually solved the problem by updating my dynamic C install to 10.66.
On another note. My end objective was to connect to a mixed mode WPA/WPA2 network that I had no control over. (ie could not put it to just WPA or WPA2)
I have just got that sorted,
When setting up the WIFI parameter list… you need to include the AES library but specify that you want to use TKIP for authentication
#define TCPCONFIG 5
#define WIFI_USE_WPA
#define WIFI_AES_ENABLED
#define IFC_WIFI_ROAM_ENABLE 1
#define IFC_WIFI_ROAM_BEACON_MISS 20
#define IFC_WIFI_MODE IFPARAM_WIFI_INFRASTRUCTURE
#define IFC_WIFI_ENCRYPTION IFPARAM_WIFI_ENCR_TKIP
#define IFC_WIFI_AUTHENTICATION IFPARAM_WIFI_AUTH_WPA_PSK
along with your SSID and Passphrase (or HEX once you have it)
Good Luck!!!