构建和运行wpa_supplicant

构建和运行wpa_supplicant

我正在尝试在我的 Arch Linux 机器上运行 WiFi Direct 以连接到 Android 智能手机。但是,当尝试查找 WiFi Direct 对等点时,FAIL会返回该消息,并且没有其他错误消息。我怎样才能找出问题所在?

wpa_supplicant 的 P2P 自述文件这篇博文,我从 git 编译了 wpa_supplicant (截至 2017 年 5 月 31 日的repo git://w1.fi/srv/git/hostap.git、 commit 、 master ,构建配置见下文)。2d18ab40826ecaec26bfd82d42dcb08f2715e362

我开始wpa_supplicant并曾经wpa_cli发出该命令p2p_find,但是,这会返回消息,在输出中、在输出或系统日志中FAIL都没有其他信息( )wpa_cliwpa_supplicantjournalctl -f

我怎样才能wpa_supplicant显示有用的错误消息?


构建和运行wpa_supplicant

git clone git://w1.fi/srv/git/hostap.git
cd hostapd/wpa_supplicant
cp defconf .config
# Edit .config to uncomment:
#  * CONFIG_AP=y
#  * CONFIG_P2P=y
#  * CONFIG_wps=y
#  * (CONFIG_DRIVER_NL80211=y) enabled by default
#  * (CONFIG_CTRL_IFACE=y)     enabled by default
# 
#  * CONFIG_LIBNL32=y (Arch Linux uses libnl 3.2)
# 
make

# Run wpa_supplicant. See below for config files
sudo ./wpa_supplicant -c/etc/wpa_supplicant/p2p.conf -iwlan0 -dd -Dnl80211

wpa_supplicant 点对点配置

/etc/wpa_supplicant/p2p.conf

ctrl_interface=DIR=/var/run/wpa_supplicant 
update_config=1
device_name=My Arch Machine
device_type=1-0050F204-1
driver_param=use_p2p_group_interface=1

日志文件

wpa_cli会话(之后的用户输入>

> wpa_cli
wpa_cli v2.6
[...]
Selected interface 'wlan0'

Interactive mode

> p2p_find
FAIL

wpa_supplicant标准输出。p2p_find从内部调用的点wpa_cli标记为# < ------ p2p_find ------ >

/etc/wpa_supplicant/p2p.conf' driver 'nl80211' ctrl_interface 'N/A' bridge 'N/A'
Configuration file '/etc/wpa_supplicant/p2p.conf' -> '/etc/wpa_supplicant/p2p.conf'
Reading configuration file '/etc/wpa_supplicant/p2p.conf'
ctrl_interface='DIR=/var/run/wpa_supplicant'
update_config=1
device_name='My Arch Machine'
driver_param='use_p2p_group_interface=1'
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Supported cipher 00-0f-ac:10
nl80211: Supported cipher 00-0f-ac:8
nl80211: Supported cipher 00-0f-ac:9
nl80211: Using driver-based off-channel TX
nl80211: Driver-advertised extended capabilities (default) - hexdump(len=8): 00 00 00 00 00 00 00 40
nl80211: Driver-advertised extended capabilities mask (default) - hexdump(len=8): 00 00 00 00 00 00 00 40
nl80211: interface wlan0 in phy phy0
nl80211: Set mode ifindex 3 iftype 2 (STATION)
nl80211: Subscribe to mgmt frames with non-AP handle 0xa6c350
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xa6c350 match=040a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xa6c350 match=040b
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xa6c350 match=040c
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xa6c350 match=040d
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xa6c350 match=090a
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xa6c350 match=090b
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xa6c350 match=090c
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xa6c350 match=090d
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xa6c350 match=0409506f9a09
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xa6c350 match=7f506f9a09
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xa6c350 match=06
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xa6c350 match=0a07
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xa6c350 match=0a11
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xa6c350 match=1101
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xa6c350 match=1102
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xa6c350 match=0505
nl80211: Register frame type=0xd0 (WLAN_FC_STYPE_ACTION) nl_handle=0xa6c350 match=0500
rfkill: initial event: idx=1 type=1 op=0 soft=0 hard=0
netlink: Operstate: ifindex=3 linkmode=1 (userspace-control), operstate=5 (IF_OPER_DORMANT)
nl80211: driver param='use_p2p_group_interface=1'
nl80211: Use separate P2P group interface
Add interface wlan0 to a new radio phy0
nl80211: Regulatory information - country=00
nl80211: 2402-2472 @ 40 MHz 20 mBm
nl80211: 2457-2482 @ 20 MHz 20 mBm (no IR)
nl80211: 2474-2494 @ 20 MHz 20 mBm (no OFDM) (no IR)
nl80211: 5170-5250 @ 80 MHz 20 mBm (no IR)
nl80211: 5250-5330 @ 80 MHz 20 mBm (DFS) (no IR)
nl80211: 5490-5730 @ 160 MHz 20 mBm (DFS) (no IR)
nl80211: 5735-5835 @ 80 MHz 20 mBm (no IR)
nl80211: 57240-63720 @ 2160 MHz 0 mBm
nl80211: Added 802.11b mode based on 802.11g information
wlan0: Own MAC address: 00:26:82:b0:3a:0a
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0
wlan0: RSN: flushing PMKID list in the driver
nl80211: Flush PMKIDs
wlan0: State: DISCONNECTED -> INACTIVE
wlan0: WPS: UUID based on MAC address: cfafece3-a583-5946-bcde-95bd75350713
ENGINE: Loading dynamic engine
ENGINE: Loading dynamic engine
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: Supplicant port status: Unauthorized
nl80211: Skip set_supp_port(unauthorized) while not associated
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
wlan0: Added interface wlan0
wlan0: State: INACTIVE -> DISCONNECTED
nl80211: Set wlan0 operstate 0->0 (DORMANT)
netlink: Operstate: ifindex=3 linkmode=-1 (no change), operstate=5 (IF_OPER_DORMANT)
random: Got 20/20 bytes from /dev/random
RTM_NEWLINK: ifi_index=3 ifname=wlan0 operstate=2 linkmode=0 ifi_family=0 ifi_flags=0x1003 ([UP])
RTM_NEWLINK: ifi_index=3 ifname=wlan0 operstate=2 linkmode=1 ifi_family=0 ifi_flags=0x1003 ([UP])
EAPOL: disable timer tick
CTRL_IFACE monitor attached /tmp/wpa_ctrl_14358-125\x00
CTRL-DEBUG: ctrl_sock-sendto: sock=12 sndbuf=212992 outq=0 send_len=3
# < ------ p2p_find ------ >
wlan0: Control interface command 'P2P_FIND'
CTRL-DEBUG: ctrl_sock-sendto: sock=12 sndbuf=212992 outq=0 send_len=5
^Cwlan0: Removing interface wlan0
wlan0: Request to deauthenticate - bssid=00:00:00:00:00:00 pending_bssid=00:00:00:00:00:00 reason=3 state=DISCONNECTED
wlan0: State: DISCONNECTED -> DISCONNECTED
nl80211: Set wlan0 operstate 0->0 (DORMANT)
netlink: Operstate: ifindex=3 linkmode=-1 (no change), operstate=5 (IF_OPER_DORMANT)
EAPOL: External notification - portEnabled=0
EAPOL: External notification - portValid=0
wlan0: WPA: Clear old PMK and PTK
wlan0: Cancelling scan request
wlan0: Cancelling authentication timeout
Off-channel: Clear pending Action frame TX (pending_action_tx=(nil)
Remove interface wlan0 from radio phy0
Remove radio phy0
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
nl80211: Remove monitor interface: refcount=0
netlink: Operstate: ifindex=3 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
nl80211: Set mode ifindex 3 iftype 2 (STATION)
nl80211: Unsubscribe mgmt frames handle 0x88888888882e4bd9 (mode change)
wlan0: CTRL-EVENT-TERMINATING 
CTRL-DEBUG: ctrl_sock-sendmsg: sock=12 sndbuf=212992 outq=0 send_len=23
CTRL_IFACE monitor sent successfully to /tmp/wpa_ctrl_14358-125\x00
CTRL_IFACE wait for attached monitors to receive messages

journalctl -f

Mai 31 09:40:17 arch sudo[31534]: user : TTY=pts/3 ; PWD=/home/user/Computer/Network/wifi-direct/hostap/wpa_supplicant ; USER=root ; COMMAND=./wpa_supplicant -c/etc/wpa_supplicant/p2p.conf -iwlan0 -dd -Dnl80211
Mai 31 09:40:17 arch sudo[31534]: pam_unix(sudo:session): session opened for user root by user(uid=0)
Mai 31 09:40:17 arch kernel: brcmsmac bcma0:1: brcms_ops_bss_info_changed: qos enabled: false (implement)
Mai 31 09:40:17 arch kernel: brcmsmac bcma0:1: brcms_ops_config: change power-save mode: false (implement)
Mai 31 09:40:17 arch kernel: IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
# < ------ p2p_find ------ >
Mai 31 09:40:35 arch sudo[31534]: pam_unix(sudo:session): session closed for user root

系统信息

uname -a
## Linux arch 4.11.2-1-ARCH #1 SMP PREEMPT Mon May 22 06:53:49 CEST 2017 x86_64 GNU/Linux

lspci -k
## 05:00.0 Network controller: Broadcom Limited BCM43225 802.11b/g/n (rev 01)
##         Subsystem: Broadcom Limited Device 04da
##         Kernel driver in use: bcma-pci-bridge
##         Kernel modules: bcma

WLAN 卡功能

iw list输出: 能力P2P-clientP2P-GOP2P-device 都在那里。

Wiphy phy0
    max # scan SSIDs: 4
    max scan IEs length: 2257 bytes
    max # sched scan SSIDs: 0
    max # match sets: 0
    max # scan plans: 1
    max scan plan interval: -1
    max scan plan iterations: 0
    Retry short limit: 7
    Retry long limit: 4
    Coverage class: 0 (up to 0m)
    Device supports RSN-IBSS.
    Supported Ciphers:
            * WEP40 (00-0f-ac:1)
            * WEP104 (00-0f-ac:5)
            * TKIP (00-0f-ac:2)
            * CCMP-128 (00-0f-ac:4)
            * CCMP-256 (00-0f-ac:10)
            * GCMP-128 (00-0f-ac:8)
            * GCMP-256 (00-0f-ac:9)
    Available Antennas: TX 0 RX 0
    Supported interface modes:
             * IBSS
             * managed
             * AP
             * AP/VLAN
             * monitor
    Band 1:
            Capabilities: 0x7c
                    HT20
                    SM Power Save disabled
                    RX Greenfield
                    RX HT20 SGI
                    RX HT40 SGI
                    No RX STBC
                    Max AMSDU length: 3839 bytes
                    No DSSS/CCK HT40
            Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
            Minimum RX AMPDU time spacing: 8 usec (0x06)
            HT Max RX data rate: 500 Mbps
            HT TX/RX MCS rate indexes supported: 0-15
            Bitrates (non-HT):
                    * 1.0 Mbps
                    * 2.0 Mbps (short preamble supported)
                    * 5.5 Mbps (short preamble supported)
                    * 11.0 Mbps (short preamble supported)
                    * 6.0 Mbps
                    * 9.0 Mbps
                    * 12.0 Mbps
                    * 18.0 Mbps
                    * 24.0 Mbps
                    * 36.0 Mbps
                    * 48.0 Mbps
                    * 54.0 Mbps
            Frequencies:
                    * 2412 MHz [1] (19.0 dBm)
                    * 2417 MHz [2] (19.0 dBm)
                    * 2422 MHz [3] (19.0 dBm)
                    * 2427 MHz [4] (19.0 dBm)
                    * 2432 MHz [5] (19.0 dBm)
                    * 2437 MHz [6] (19.0 dBm)
                    * 2442 MHz [7] (19.0 dBm)
                    * 2447 MHz [8] (19.0 dBm)
                    * 2452 MHz [9] (19.0 dBm)
                    * 2457 MHz [10] (19.0 dBm)
                    * 2462 MHz [11] (19.0 dBm)
                    * 2467 MHz [12] (19.0 dBm)
                    * 2472 MHz [13] (19.0 dBm)
                    * 2484 MHz [14] (disabled)
    Supported commands:
             * new_interface
             * set_interface
             * new_key
             * start_ap
             * new_station
             * new_mpath
             * set_mesh_config
             * set_bss
             * authenticate
             * associate
             * deauthenticate
             * disassociate
             * join_ibss
             * join_mesh
             * set_tx_bitrate_mask
             * frame
             * frame_wait_cancel
             * set_wiphy_netns
             * set_channel
             * set_wds_peer
             * probe_client
             * set_noack_map
             * register_beacons
             * start_p2p_device
             * set_mcast_rate
             * connect
             * disconnect
             * set_qos_map
             * Unknown command (121)
    Supported TX frame types:
             * IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
             * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
             * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
             * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
             * mesh point: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
             * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
             * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
             * P2P-device: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
    Supported RX frame types:
             * IBSS: 0x40 0xb0 0xc0 0xd0
             * managed: 0x40 0xd0
             * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
             * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
             * mesh point: 0xb0 0xc0 0xd0
             * P2P-client: 0x40 0xd0
             * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
             * P2P-device: 0x40 0xd0
    software interface modes (can always be added):
             * AP/VLAN
             * monitor
    interface combinations are not supported
    HT Capability overrides:
             * MCS: ff ff ff ff ff ff ff ff ff ff
             * maximum A-MSDU length
             * supported channel width
             * short GI for 40 MHz
             * max A-MPDU length exponent
             * min MPDU start spacing
    Device supports TX status socket option.
    Device supports HT-IBSS.
    Device supports SAE with AUTHENTICATE command
    Device supports low priority scan.
    Device supports scan flush.
    Device supports AP scan.
    Device supports per-vif TX power setting
    Driver supports full state transitions for AP/GO clients
    Driver supports a userspace MPM
    Device supports configuring vdev MAC-addr on create.

答案1

iw list输出中可以看出:开源驱动程序brcmfmac不支持P2P模式。

支持的模式:

Supported interface modes:
         * IBSS
         * managed
         * AP
         * AP/VLAN
         * monitor

P2P 支持标记unknown维基开发者

Supported modes

STA (Station) mode: supported
IBSS (Ad-Hoc) mode: supported
AP (Master) mode: unsupported
Mesh (802.11s) mode: unsupported
P2P mode: unknown
Monitor mode: supported
Packet injection: unknown

相关内容