免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 15228 | 回复: 2
打印 上一主题 下一主题

[应用] wpa_cli 不能连接到 wpa_supplicant [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-11-15 23:19 |只看该作者 |倒序浏览
我用的LINUX 2.6内核,目标板是ARM,我想在板子上使用WIFI,所以使用了wpa_supplicant这个东西
我成功的用wpa_supplicant连接到了一个网络,输出信息如下

State: GROUP_HANDSHAKE -> COMPLETED
CTRL-EVENT-CONNECTED - Connection to 00:25:9c:2a:98:6e completed (auth) [id=0 id_str=]
wpa_driver_wext_set_operstate: operstate 0->1 (UP)
netlink: Operstate: linkmode=-1, operstate=6
EAPOL: External notification - portValid=1
EAPOL: External notification - EAP success=1
EAPOL: SUPP_PAE entering state AUTHENTICATING
EAPOL: SUPP_BE entering state SUCCESS
EAP: EAP entering state DISABLED
EAPOL: SUPP_PAE entering state AUTHENTICATED
EAPOL: Supplicant port status: Authorized
EAPOL: SUPP_BE entering state IDLE
EAPOL authentication completed successfully
RTM_NEWLINK: operstate=1 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
RTM_NEWLINK: operstate=1 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
Wireless event: cmd=0x8b19 len=8
Received 3099 bytes of scan results (15 BSSes)
BSS: Start scan result update 2
BSS: Add new id 11 BSSID 00:19:70:75:50:5b SSID 'Bbox-A8BDC8'
BSS: Add new id 12 BSSID f4:ca:e5:f5:80:a4 SSID 'FREEBOX_GUILLAUMEMADELEINE_7E'
BSS: Add new id 13 BSSID 00:19:15:38:7d:d8 SSID ''
BSS: Add new id 14 BSSID 00:26:f2:db:f8:d9 SSID 'NUMERICABLE-61A2'
New scan results available
Selecting BSS from priority group 0
Try to find WPA-enabled AP
0: 00:25:9c:2a:98:6e ssid='WAP-MDI' wpa_ie_len=26 rsn_ie_len=24 caps=0x11
   selected based on RSN IE
   selected WPA AP 00:25:9c:2a:98:6e ssid='WAP-MDI'
Considering within-ESS reassociation
Current BSS: 00:25:9c:2a:98:6e level=174
Selected BSS: 00:25:9c:2a:98:6e level=174
Skip roam - too small difference in signal level
EAPOL: startWhen --> 0
EAPOL: disable timer tick

随后我想用wpa_cli的时候,就出现了下面的问题:

Selected interface 'wlan0'
Could not connect to wpa_supplicant - re-trying

我的配置文件如下:
ctrl_interface=/var/run/wpa_supplicant
network={
        ssid="WAP-MDI"
        #psk="nmwkrdNuU1kTfl4V"
        psk=81205a716d73772acdd8332fa7e74fcc1f5bb2cbc5e1bedacaee4328ac39060c
        proto=WPA2
        key_mgmt=WPA-PSK
        pairwise=CCMP TKIP
}

有没有人能帮我解决下这个问题阿,我实在是搞不定了。。。。  非常感谢阿

论坛徽章:
0
2 [报告]
发表于 2011-11-16 23:47 |只看该作者
将wpa_supplicant可执行文件拷贝到/var/run/wpa_supplicant试试

论坛徽章:
0
3 [报告]
发表于 2011-11-17 11:55 |只看该作者
本帖最后由 armips 于 2011-11-17 11:57 编辑

请确保有wpa_supplican目录(当wpa_supplican启动后)
目录下有wlan0的socket节点,应该就没有问题了
  1. ls /var/run/wpa_supplicant/ -l
  2. total 0
  3. srwxrwx---    1 root     root             0 Nov 17 11:41 wlan0
复制代码
这时应该就好用了:
  1. # wpa_cli
  2. wpa_cli v0.7.3
  3. Copyright (c) 2004-2010, Jouni Malinen <j@w1.fi> and contributors

  4. This program is free software. You can distribute it and/or modify it
  5. under the terms of the GNU General Public License version 2.

  6. Alternatively, this software may be distributed under the terms of the
  7. BSD license. See README and COPYING for more details.


  8. Selected interface 'wlan0'

  9. Interactive mode

  10. > help
  11. commands:
  12.   status [verbose] = get current WPA/EAPOL/EAP status
  13.   ping = pings wpa_supplicant
  14.   mib = get MIB variables (dot1x, dot11)
  15.   help = show this usage help
  16.   interface [ifname] = show interfaces/select interface
  17.   level <debug level> = change debug level
  18.   license = show full wpa_cli license
  19.   quit = exit wpa_cli
  20.   set = set variables (shows list of variables when run without arguments)
  21.   logon = IEEE 802.1X EAPOL state machine logon
  22.   logoff = IEEE 802.1X EAPOL state machine logoff
  23.   pmksa = show PMKSA cache
  24.   reassociate = force reassociation
  25.   preauthenticate <BSSID> = force preauthentication
  26.   identity <network id> <identity> = configure identity for an SSID
  27.   password <network id> <password> = configure password for an SSID
  28.   new_password <network id> <password> = change password for an SSID
  29.   pin <network id> <pin> = configure pin for an SSID
  30.   otp <network id> <password> = configure one-time-password for an SSID
  31.   passphrase <network id> <passphrase> = configure private key passphrase
  32.     for an SSID
  33.   bssid <network id> <BSSID> = set preferred BSSID for an SSID
  34.   list_networks = list configured networks
  35.   select_network <network id> = select a network (disable others)
  36.   enable_network <network id> = enable a network
  37.   disable_network <network id> = disable a network
  38.   add_network = add a network
  39.   remove_network <network id> = remove a network
  40.   set_network <network id> <variable> <value> = set network variables (shows
  41.     list of variables when run without arguments)
  42.   get_network <network id> <variable> = get network variables
  43.   save_config = save the current configuration
  44.   disconnect = disconnect and wait for reassociate/reconnect command before
  45.     connecting
  46.   reconnect = like reassociate, but only takes effect if already disconnected
  47.   scan = request new BSS scan
  48.   scan_results = get latest scan results
  49.   bss <<idx> | <bssid>> = get detailed scan result info
  50.   get_capability <eap/pairwise/group/key_mgmt/proto/auth_alg> = get capabilies
  51.   reconfigure = force wpa_supplicant to re-read its configuration file
  52.   terminate = terminate wpa_supplicant
  53.   interface_add <ifname> <confname> <driver> <ctrl_interface> <driver_param>
  54.     <bridge_name> = adds new interface, all parameters but <ifname>
  55.     are optional
  56.   interface_remove <ifname> = removes the interface
  57.   interface_list = list available interfaces
  58.   ap_scan <value> = set ap_scan parameter
  59.   stkstart <addr> = request STK negotiation with <addr>
  60.   ft_ds <addr> = request over-the-DS FT with <addr>
  61.   wps_pbc [BSSID] = start Wi-Fi Protected Setup: Push Button Configuration
  62.   wps_pin <BSSID> [PIN] = start WPS PIN method (returns PIN, if not hardcoded)
  63.   wps_reg <BSSID> <AP PIN> = start WPS Registrar to configure an AP
  64.   wps_er_start = start Wi-Fi Protected Setup External Registrar
  65.   wps_er_stop = stop Wi-Fi Protected Setup External Registrar
  66.   wps_er_pin <UUID> <PIN> = add an Enrollee PIN to External Registrar
  67.   wps_er_pbc <UUID> = accept an Enrollee PBC using External Registrar
  68.   wps_er_learn <UUID> <PIN> = learn AP configuration
  69.   ibss_rsn <addr> = request RSN authentication with <addr> in IBSS
  70.   suspend = notification of suspend/hibernate
  71.   resume = notification of resume/thaw
  72.   drop_sa = drop SA without deauth/disassoc (test command)
  73.   roam <addr> = roam to the specified BSS
  74. > quit
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP