2
votes

I am trying to implement a code which is using wpa_cli & iw to configure/add/remove/test new network entry to my wpa conf.

To add a new network my process is :

wpa_cli list_network

my new entry already exist ? yes -> remove it

wpa_cli add_network -> create entry empty entry with id 42

wpa_cli set_network 42 ssid '"tutu"'

wpa_cli set_network 42 psk '"mypassword"'

wpa_cli enable 42

wpa_cli save_config

-> update wpa_conf file with new entry

wpa_cli select_network 42

-> use this command to test connexion with only this network entry check every second during 10 seconds, iw dev wlan0 link result to check that ssid/psk info are good.

I am not very sure about this process. Moreover, it seems that there is a cache somewhere. If I replace an existing entry but with fake psk, I am always connected to this entry.

example :

I have a wireless network setup like this : ssid : tutu password : mypassword

I add the configuration tutu/mypassword thanks to my process. After the select_network, the iw link show "Connected". Great.

Now I add the configuration tutu/badpassword with the same process. The older configuration is removed. The select_network and iw link always success even if the new password is wrong...

EDIT :

I found some good information here to validate my process : http://rtl8192cu.googlecode.com/hg-history/bdd3a2265bdd6a92f24cef3d52fa594b2844c9c1/document/wpa_cli_with_wpa_supplicant.pdf

But I have always some failed. I run endurance test en wifi connection. On 100 tests with good ssid/psk, 99 success, 1 failed.

1
So what is your question?Ross
Sorry Ross. I add an example to explain why my process seems to be wrong.ArthurLambert

1 Answers

0
votes

when conf changed or config saved, use

wpa_cli reconfigure

then wpa-supplicant will re-read its configuration file