2018-05-30
14:12:46
于深圳南山科技园
最近有个项目,客户需要通过手机app通过机器wifi热点连接,从而实现对机器的设置及视频的实时预览等各种功能。这两天一直在搞rtl8188eu的wifi热点,各种驱动服务都搭建好了,但是出现怪异的现象折腾了好几天也没找到原因及解决办法,
硬件平台:全志T3车载芯片 + rtl8188euwifi模块(usb连接)
系统:linux kernel-3.10
ap启动脚本:ap-start.sh
hostapd版本:0.8x
DHCp版本:4.1.1-P1
ap-start.sh
ifconfig wlan0 192.168.1.24 netmask 255.255.255.0 sleep 1 hostapd /etc/hostapd.conf -B touch /var/lib/dhcp/dhcpd.leases dhcpd
/etc/hostapd.conf
##### hostapd configuration file ############################################## interface=wlan0 ctrl_interface=/var/run/hostapd ssid=carwifi channel=9 wpa=1 wpa_passphrase=88888888 # Device Name # User-friendly description of device; up to 32 octets encoded in UTF-8 device_name=RTL8192CU # Primary Device Type # Used format: <categ>-<OUI>-<subcateg> # categ = Category as an integer value # OUI = OUI and type octet as a 4-octet hex-encoded value; 0050F204 for # default WPS OUI # subcateg = OUI-specific Sub Category as an integer value # Examples: # 1-0050F204-1 (Computer / PC) # 1-0050F204-2 (Computer / Server) # 5-0050F204-1 (Storage / NAS) # 6-0050F204-1 (Network Infrastructure / AP) device_type=6-0050F204-1 ##### default configuration ####################################### driver=rtl871xdrv beacon_int=100 hw_mode=g ieee80211n=1 wme_enabled=1 wpa_key_mgmt=WPA-PSK wpa_pairwise=CCMP rsn_pairwise=TKIP CCMP max_num_sta=8 wpa_group_rekey=86400
/etc/dhcpd.conf
# # Sample configuration file # default-lease-time 600; max-lease-time 7200; # If this DHCP server is the official DHCP server for the local # network, the authoritative directive should be uncommented. #authoritative; # Use this to send dhcp log messages to a different log file (you also # have to hack syslog.conf to complete the redirection). log-facility local7; # No service will be given on this subnet, but declaring it helps the # DHCP server to understand the network topology. subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.8 192.168.1.128; }
开机启动log如下
[ 5.600133] insmod_host_driver [ 5.600133] [ 5.606765] [ehci0-controller]: sunxi_usb_enable_ehci [ 5.609585] RTL871X: module init start [ 5.609593] RTL871X: rtl8188eu driver version = v4.2.5_9909.20131204_beta [ 5.609597] RTL871X: build time: May 21 2018 17:49:00 [ 5.630092] [sunxi-ehci0]: probe, pdev->name: 1c14000.ehci0-controller, sunxi_ehci: 0xc0a7a474, 0x:f1c14000, irq_no:47 [ 5.642162] sunxi-ehci 1c14000.ehci0-controller: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver [ 5.652338] sunxi-ehci 1c14000.ehci0-controller: new USB bus registered, assigned bus number 1 [ 5.662652] sunxi-ehci 1c14000.ehci0-controller: irq 71, io mem 0xce0e21c0 [ 5.690130] sunxi-ehci 1c14000.ehci0-controller: USB 0.0 started, EHCI 1.00 [ 5.697960] ehci_irq: highspeed device connect [ 5.697961] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002 [ 5.697969] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 5.697976] usb usb1: Product: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver [ 5.697981] usb usb1: Manufacturer: Linux 3.10.65 ehci_hcd [ 5.697987] usb usb1: SerialNumber: sunxi-ehci [ 5.739687] usbcore: registered new interface driver rtl8188eu [ 5.740200] hub 1-0:1.0: USB hub found [ 5.740248] hub 1-0:1.0: 1 port detected [ 5.740903] [ohci0-controller]: sunxi_usb_enable_ohci [ 5.740914] [sunxi-ohci0]: probe, pdev->name: 1c14000.ohci0-controller, sunxi_ohci: 0xc0a79c94 [ 5.740988] sunxi-ohci 1c14000.ohci0-controller: SW USB2.0 'Open' Host Controller (OHCI) Driver [ 5.741031] sunxi-ohci 1c14000.ohci0-controller: new USB bus registered, assigned bus number 2 [ 5.741124] sunxi-ohci 1c14000.ohci0-controller: irq 72, io mem 0xce0e21c0 [ 5.797124] RTL871X: module init ret=0 [ 5.804269] usb usb2: New USB device found, idVendor=1d6b, idProduct=0001 [ 5.811983] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 5.820065] usb usb2: Product: SW USB2.0 'Open' Host Controller (OHCI) Driver [ 5.827902] usb usb2: Manufacturer: Linux 3.10.65 ohci_hcd [ 5.834168] usb usb2: SerialNumber: sunxi-ohci [ 5.841066] hub 2-0:1.0: USB hub found [ 5.845235] hub 2-0:1.0: 1 port detected [ 6.050213] usb 1-1: new high-speed USB device number 2 using sunxi-ehci [ 6.203434] usb 1-1: New USB device found, idVendor=0bda, idProduct=8179 [ 6.210984] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 6.218838] usb 1-1: Product: 802.11n WLAN NIC [ 6.223950] usb 1-1: Manufacturer: Realtek [ 6.243032] bFWReady == _FALSE call reset 8051... [ 6.337470] RTL871X: rtw_ndev_init(wlan0) [ 6.353064] RTL871X: rtw_ndev_init(wlan1) [ 8.221550] ==> rtl8188e_iol_efuse_patch [ 8.677931] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready Configuration file: /etc/hostapd.conf drv->ifindex=6 l2_sock_recv==l2_sock_xmit=0x0xb17648 +rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2 rtl871x_set_key_ops rtl871x_set_key_ops rtl871x_set_key_ops rtl871x_set_key_ops Using interface wlan0 with hwaddr 14:6b:9c:08:f7:df and ssid 'carwifi' rtl871x_set_wps_assoc_resp_ie rtl871x_set_wps_beacon_ie rtl871x_set_wps_probe_resp_ie rtl871x_set_beacon_ops [ 10.490315] gpu cooling callback set freq limit 384 [ 10.894119] RTL871X: assoc success rtl871x_set_hidden_ssid ignore_b[ 10.898742] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready roadcast_ssid:0, carwifi,7 rtl871x_set_acl Internet Systems Consortium DHCP Server 4.1.1-P1 Copyright 2004-2010 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/ Wrote 0 leases to leases file. Listening on LPF/wlan0/14:6b:9c:08:f7:df/192.168.1.0/24 Sending on LPF/wlan0/14:6b:9c:08:f7:df/192.168.1.0/24 Sending on Socket/fallback/fallback-net
问题现象:
wifi热点已经可以正常扫描识别,在设置wpa=0(不采用wpa加密,无需密码可以直接连接)时候,设备可以正常连接到该热点。
/var/run/hostapd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page. # This lease file was written by isc-dhcp-4.1.1-P1 lease 192.168.1.8 { starts 4 1970/01/01 04:30:12; ends 4 1970/01/01 04:40:12; cltt 4 1970/01/01 04:30:12; binding state active; next binding state free; hardware ethernet 2c:f0:a2:98:01:8d; uid "\001,\360\242\230\001\215"; client-hostname "iPhone-9S"; }
但是如果设置成1或者2、3设备都无法连接到改热点,一直弹出密码错误。同事内核输出log
[ 59.865837] RTL871X: ap recv disassoc reason code(8) sta:2c:f0:a2:98:01:8d [ 59.876976] RTL871X: set pairwise key to hw: alg:0(WEP40-1 WEP104-5 TKIP-2 AES-4) camid:0
根据log中提供的信息ap recv disassoc reason code(8)去网上搜索了一下提供的解释如下。
https://blog.michaelfmcnamara.com/2007/11/80211-dissassociation-codes/
Value |
802.11 or Symbol/WPA Reason Code |
Description |
0 |
REASON_CODE_80211_SUCCESS |
Reserved internally to indicate success |
1. |
REASON_CODE_80211_UNSPECIFIED_ERROR |
Unspecified Reason |
3. |
DISASSOCIATION_REASON_CODE_STATION_LEAVING_ESS |
Deauthenticated because sending station has left or is leaving IBSS or ESS |
4. |
DISASSOCIATION_REASON_CODE_INACTIVITY |
Disassociated due to inactivity |
5. |
DISASSOCIATION_REASON_CODE_STATION_LIMIT_EXCEEDED |
Disassociated because AP is unable to handle all currently associated stations |
6. |
DISASSOCIATION_REASON_CODE_CLASS_2_PKT_FROM_NON_AUTH |
Class 2 frame received from non-authenticated station |
7. |
DISASSOCIATION_REASON_CODE_CLASS_3_PKT_FROM_NON_ASSOC |
Class 3 frame received from non-associated station |
8. |
DISASSOCIATION_REASON_CODE_STATION_LEAVING_BSS |
Disassociated because sending station has left or is leaving BSS |
9. |
DISASSOCIATION_REASON_CODE_STATION_NOT_AUTHENTICATED |
Station requesting re-association is not authenticated with responding station |
13. |
DISASSOCIATION_REASON_CODE_INVALID_INFORMATION_ELEMENT |
Invalid Information Element |
14. |
DISASSOCIATION_REASON_CODE_MIC_FAILURE |
Michael MIC failure |
15. |
DISASSOCIATION_REASON_CODE_4WAY_HANDSHAKE_TIMEOUT |
4-Way Handshake timeout |
16. |
DISASSOCIATION_REASON_CODE_GROUP_KEY_UPDATE_TIMEOUT |
Group key update timeout |
17. |
DISASSOCIATION_REASON_CODE_4WAY_IE_DIFFERENCE |
Information element in 4-Way Handshake different from Re-associated request/Proberesponse/Beacon |
18. |
DISASSOCIATION_REASON_CODE_MULTICAST_CIPHER_INVALID |
Multicast Cipher is not valid |
19. |
DISASSOCIATION_REASON_CODE_UNICAST_CIPHER_INVALID |
Unicast Cipher is not valid |
20. |
DISASSOCIATION_REASON_CODE_AKMP_NOT_VALID |
AKMP is not valid |
21. |
DISASSOCIATION_REASON_CODE_UNSUPPORTED_RSNE_VERSION |
Unsupported RSN IE version |
22. |
DISASSOCIATION_REASON_CODE_INVALID_RSNE_CAPABILITIES |
Invalid RSN IE Capabilities |
23. |
DISASSOCIATION_REASON_CODE_8021X_AUTHENTICATION_FAILED |
IEEE 802.1X Authentication failed |
44. |
DISASSOCIATION_REASON_CODE_PSP_TX_PKT_BUFFER_EXCEEDED |
Symbol defined (non 802.11 standard) code. The Wireless Switch has exceeded it’s time limit in attempting to deliver buffered PSP frames to the Mobile Unit without receiving a single 802.11 PS Poll or NULL data frame. The Wireless Switch begins the timer when it sets the Mobile Unit’s bit in the TIM section of the 802.11 beacon frame for the BSS. The time limit is at least 15 seconds. The Mobile Unit is probably gone (or may be faulty). |
77. |
DISASSOCIATION_REASON_CODE_TRANSMIT_RETRIES_EXCEEDED |
Symbol defined (non 802.11 standard) codes. The Wireless Switch has exceeded it’s retry limit in attempting to deliver a 802.1x EAP message to the Mobile Unit without receiving a single 802.11 ACK. The retry limit varies according to traffic type but is at least 64 times. The Mobile Unit is either gone or has incorrect 802.1x EAP authentication settings. |
但是依然找不到原因和解决办法,继续研究中。