Eu tenho um sistema executando Linux embarcado aberto com a placa USB sem fio Ralink RT5572. Eu tenho o driver instalado junto com o wpa_supplicant e preciso poder conectar-me a uma rede segura WPA2. Pelo que sei, posso trazer a interface com a configuração correta e, após alguns segundos, ela se autentica. Eu vejo dois pacotes de autenticação no Wireshark vindos do dispositivo, e o log diz que ele passa. Nesse ponto, desejo executar o udhcpc ou o dhclient na interface para obter um endereço IP, mas nenhum deles funcionará. Não vejo mais pacotes na rede do dispositivo. Também tentei definir um IP estático e, mesmo assim, não consigo executar ping no gateway ou em qualquer outro computador na rede.
Aqui está o meu arquivo wpa_supplicant.conf:
ctrl_interface=/var/run/wpa_supplicant
update_config=1
ap_scan=1
network={
ssid="HTC One M9 8506"
psk=###########################################
scan_ssid=1
key_mgmt=WPA-PSK
proto=WPA2
pairwise=CCMP TKIP
group=CCMP TKIP
auth_alg=OPEN
}
Aqui está o meu log do wpa_supplicant:
som9g45:~# ifup ra0
+ '[' ra0 = lo ']'
+ '[' -n '' ']'
+ WPA_IFACE=ra0
+ '[' -f /etc/wpa_supplicant/functions.sh ']'
+ . /etc/wpa_supplicant/functions.sh
++ WPA_SUP_BIN=/usr/sbin/wpa_supplicant
++ WPA_SUP_PNAME=wpa_supplicant
++ WPA_SUP_PIDFILE=/var/run/wpa_supplicant.ra0.pid
++ WPA_CLI_BIN=/usr/sbin/wpa_cli
++ WPA_CLI_PNAME=wpa_cli
++ WPA_CLI_PIDFILE=/var/run/wpa_action.ra0.pid
++ WPA_CLI_LOGFILE=/var/log/wpa_action.log
++ WPA_CLI_TIMESTAMP=/var/run/wpa_action.ra0.timestamp
++ '[' -z '' ']'
++ WPA_CTRL_DIR=/var/run/wpa_supplicant
++ '[' -n '' ']'
++ '[' '' = 1 ']'
++ TO_NULL=/dev/null
++ DAEMON_VERBOSITY=--quiet
+ '[' '!' -x /usr/sbin/wpa_supplicant ']'
+ '[' '!' -x /usr/sbin/wpa_cli ']'
+ test_wpa_cli
+ test_daemon_pidfile /usr/sbin/wpa_cli /var/run/wpa_action.ra0.pid
+ local DAEMON PIDFILE
+ '[' -n /usr/sbin/wpa_cli ']'
+ DAEMON=/usr/sbin/wpa_cli
+ '[' -f /var/run/wpa_action.ra0.pid ']'
+ '[' -n /usr/sbin/wpa_cli ']'
+ '[' -f '' ']'
+ return 1
+ echo 'Initial WPA Checks Pass'
Initial WPA Checks Pass
+ '[' -n '' ']'
+ '[' -n /etc/wpa_supplicant.conf ']'
+ '[' '!' -s /etc/wpa_supplicant.conf ']'
++ sed -n 's/[[:space:]]*#.*//g;s/[[:space:]]\+.*$//g;s/^\(ctrl_interface\|DIR\)=\(.*\)/\2/p' /etc/wpa_supplicant.conf
+ WPA_SUP_CONF_CTRL_DIR=/var/run/wpa_supplicant
+ '[' -n /var/run/wpa_supplicant ']'
+ WPA_CTRL_DIR=/var/run/wpa_supplicant
+ WPA_SUP_CONF='-c /etc/wpa_supplicant.conf -C /var/run/wpa_supplicant'
+ case "$MODE" in
+ PHASE=pre-up
+ echo 'WPA: Configuring Interface'
WPA: Configuring Interface
+ case "$PHASE" in
+ kill_wpa_supplicant
+ test_wpa_supplicant
+ test_daemon_pidfile /usr/sbin/wpa_supplicant /var/run/wpa_supplicant.ra0.pid
+ local DAEMON PIDFILE
+ '[' -n /usr/sbin/wpa_supplicant ']'
+ DAEMON=/usr/sbin/wpa_supplicant
+ '[' -f /var/run/wpa_supplicant.ra0.pid ']'
+ '[' -n /usr/sbin/wpa_supplicant ']'
+ '[' -f '' ']'
+ return 1
+ '[' -S /var/run/wpa_supplicant/ra0 ']'
+ init_wpa_supplicant
+ '[' -n '-c /etc/wpa_supplicant.conf -C /var/run/wpa_supplicant' ']'
+ '[' -n '' ']'
+ local WPA_SUP_DRIVER WPA_SUP_OPTIONS
+ '[' -n '' ']'
+ WPA_SUP_OPTIONS='-B -P /var/run/wpa_supplicant.ra0.pid -i ra0'
+ '[' -n '' ']'
+ '[' -n ralink ']'
+ WPA_SUP_DRIVER=ralink
+ wpa_msg verbose 'wpa-driver ralink'
+ '[' -n '' ']'
+ case "$1" in
+ shift
+ echo 'wpa_supplicant: wpa-driver ralink'
+ wpa_msg verbose '/usr/sbin/wpa_supplicant -B -P /var/run/wpa_supplicant.ra0.pid -i ra0 -D ralink -c /etc/wpa_supplicant.conf -C /var/run/wpa_supplicant'
+ '[' -n '' ']'
+ case "$1" in
+ shift
+ echo 'wpa_supplicant: /usr/sbin/wpa_supplicant -B -P /var/run/wpa_supplicant.ra0.pid -i ra0 -D ralink -c /etc/wpa_supplicant.conf -C /var/run/wpa_supplicant'
+ start-stop-daemon --start --oknodo --quiet --name wpa_supplicant --startas /usr/sbin/wpa_supplicant --pidfile /var/run/wpa_supplicant.ra0.pid -- -B -P /var/run/wpa_supplicant.ra0.pid -i ra0 -D ralink -c /etc/wpa_supplicant.conf -C /var/run/wpa_supplicant
+ '[' 0 '!=' 0 ']'
+ local WPA_SOCKET_WAIT MAX_WPA_SOCKET_WAIT
+ WPA_SOCKET_WAIT=0
+ MAX_WPA_SOCKET_WAIT=5
+ '[' -S /var/run/wpa_supplicant/ra0 ']'
+ wpa_msg verbose 'ctrl_interface socket located at /var/run/wpa_supplicant/ra0'
+ '[' -n '' ']'
+ case "$1" in
+ shift
+ echo 'wpa_supplicant: ctrl_interface socket located at /var/run/wpa_supplicant/ra0'
+ conf_wpa_supplicant
+ '[' -n '' ']'
+ '[' ralink = wired ']'
+ '[' -n '' ']'
+ wpa_cli_do '' raw ap_scan wpa-ap-scan
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw preauthenticate wpa-preauthenticate
+ '[' -z '' ']'
+ return 0
+ '[' -n '"HTC One M9 8506"' ']'
+ case "$IF_WPA_SSID" in
++ echo -n '"HTC One M9 8506"'
++ sed 's/^"//;s/"$//'
+ IF_WPA_SSID='HTC One M9 8506'
++ wpa_cli add_network
++ /usr/sbin/wpa_cli -p /var/run/wpa_supplicant -i ra0 add_network
+ WPA_ID=1
+ wpa_msg verbose 'configuring network block -- 1'
+ '[' -n '' ']'
+ case "$1" in
+ shift
+ echo 'wpa_supplicant: configuring network block -- 1'
+ wpa_cli_do 'HTC One M9 8506' ascii set_network ssid wpa-ssid
+ '[' -z 'HTC One M9 8506' ']'
+ local WPACLISET_VALUE WPACLISET_VARIABLE WPACLISET_DESC
+ case "$2" in
+ WPACLISET_VALUE='"HTC One M9 8506"'
+ case "$3" in
+ '[' -z 1 ']'
+ shift
+ WPACLISET_VARIABLE='set_network 1 ssid'
+ case "$4" in
+ WPACLISET_DESC='wpa-ssid "HTC One M9 8506"'
+ wpa_msg action 'wpa-ssid "HTC One M9 8506"'
+ '[' -n '' ']'
+ case "$1" in
+ shift
+ echo -n 'wpa_supplicant: wpa-ssid "HTC One M9 8506" -- '
+ wpa_cli set_network 1 ssid '"HTC One M9 8506"'
+ /usr/sbin/wpa_cli -p /var/run/wpa_supplicant -i ra0 set_network 1 ssid '"HTC One M9 8506"'
+ wpa_cli_do '' raw set_network priority wpa-priority
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network bssid wpa-bssid
+ '[' -z '' ']'
+ return 0
+ '[' -s '' ']'
+ '[' -s '' ']'
+ '[' -n '' ']'
+ '[' -n 8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b ']'
+ wpa_key_check_and_set 8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b
+ '[' -z 8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b ']'
+ local KEY KEY_TYPE
+ case "$1" in
+ KEY=8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b
+ ishex 8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b
+ '[' -z 8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b ']'
+ case "$1" in
+ return 0
+ '[' 64 -eq 64 ']'
+ KEY_TYPE=raw
+ wpa_cli_do 8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b raw set_network psk wpa-psk
+ '[' -z 8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b ']'
+ local WPACLISET_VALUE WPACLISET_VARIABLE WPACLISET_DESC
+ case "$2" in
+ WPACLISET_VALUE=8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b
+ case "$3" in
+ '[' -z 1 ']'
+ shift
+ WPACLISET_VARIABLE='set_network 1 psk'
+ case "$4" in
+ WPACLISET_DESC='wpa-psk *****'
+ wpa_msg action 'wpa-psk *****'
+ '[' -n '' ']'
+ case "$1" in
+ shift
+ echo -n 'wpa_supplicant: wpa-psk ***** -- '
+ wpa_cli set_network 1 psk 8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b
+ /usr/sbin/wpa_cli -p /var/run/wpa_supplicant -i ra0 set_network 1 psk 8f52e37106a9a82444cac6a48d6a7f720d44280cd7901c0c57740316f642d29b
+ wpa_cli_do '' raw set_network pairwise wpa-pairwise
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do 'TKIP CCMP' raw set_network group wpa-group
+ '[' -z 'TKIP CCMP' ']'
+ local WPACLISET_VALUE WPACLISET_VARIABLE WPACLISET_DESC
+ case "$2" in
+ WPACLISET_VALUE='TKIP CCMP'
+ case "$3" in
+ '[' -z 1 ']'
+ shift
+ WPACLISET_VARIABLE='set_network 1 group'
+ case "$4" in
+ WPACLISET_DESC='wpa-group TKIP CCMP'
+ wpa_msg action 'wpa-group TKIP CCMP'
+ '[' -n '' ']'
+ case "$1" in
+ shift
+ echo -n 'wpa_supplicant: wpa-group TKIP CCMP -- '
+ wpa_cli set_network 1 group 'TKIP CCMP'
+ /usr/sbin/wpa_cli -p /var/run/wpa_supplicant -i ra0 set_network 1 group 'TKIP CCMP'
+ wpa_cli_do '' raw set_network mode wpa-mode
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network frequency wpa-frequency
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do WPA-PSK raw set_network key_mgmt wpa-key-mgmt
+ '[' -z WPA-PSK ']'
+ local WPACLISET_VALUE WPACLISET_VARIABLE WPACLISET_DESC
+ case "$2" in
+ WPACLISET_VALUE=WPA-PSK
+ case "$3" in
+ '[' -z 1 ']'
+ shift
+ WPACLISET_VARIABLE='set_network 1 key_mgmt'
+ case "$4" in
+ WPACLISET_DESC='wpa-key-mgmt WPA-PSK'
+ wpa_msg action 'wpa-key-mgmt WPA-PSK'
+ '[' -n '' ']'
+ case "$1" in
+ shift
+ echo -n 'wpa_supplicant: wpa-key-mgmt WPA-PSK -- '
+ wpa_cli set_network 1 key_mgmt WPA-PSK
+ /usr/sbin/wpa_cli -p /var/run/wpa_supplicant -i ra0 set_network 1 key_mgmt WPA-PSK
+ wpa_cli_do '' raw set_network proto wpa-proto
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network auth_alg wpa-auth-alg
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network scan_ssid wpa-scan-ssid
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network identity wpa-identity
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network anonymous_identity wpa-anonymous-identity
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network eap wpa-eap
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network eappsk wpa-eappsk
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network nai wpa-nai
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network password wpa-password
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network ca_cert wpa-ca-cert
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network ca_path wpa-ca-path
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network client_cert wpa-client-cert
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network private_key wpa-private-key
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network private_key_passwd wpa-private-key-passwd
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network dh_file wpa-dh-file
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network subject_match wpa-subject-match
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network altsubject_match wpa-altsubject-match
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network ca_cert2 wpa-ca-cert2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network ca_path2 wpa-ca-path2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network client_cert2 wpa-client-cert2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network private_key2 wpa-private-key2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network private_key_passwd2 wpa-private-key-passwd2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network dh_file2 wpa-dh-file2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network subject_match2 wpa-subject-match2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network altsubject_match2 wpa-altsubject-match2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network eap_methods wpa-eap-methods
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network phase1 wpa-phase1
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network phase2 wpa-phase2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network pcsc wpa-pcsc
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network pin wpa-pin
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network engine wpa-engine
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network engine_id wpa-engine-id
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network key_id wpa-key-id
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network eapol_flags wpa-eapol-flags
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network wep_key0 wpa-wep-key0
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network wep_key1 wpa-wep-key1
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network wep_key2 wpa-wep-key2
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network wep_key3 wpa-wep-key3
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network wep_tx_keyidx wpa-wep-tx-keyidx
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network proactive_key_caching wpa-proactive-key-caching
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network pac_file wpa-pac-file
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network mode wpa-mode
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network peerkey wpa-peerkey
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' raw set_network fragment_size wpa-fragment-size
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do '' ascii set_network id_str wpa-id-str
+ '[' -z '' ']'
+ return 0
+ wpa_cli_do 1 raw enable_network 'enabling network block'
+ '[' -z 1 ']'
+ local WPACLISET_VALUE WPACLISET_VARIABLE WPACLISET_DESC
+ case "$2" in
+ WPACLISET_VALUE=1
+ case "$3" in
+ WPACLISET_VARIABLE=enable_network
+ case "$4" in
+ WPACLISET_DESC='enabling network block 1'
+ wpa_msg action 'enabling network block 1'
+ '[' -n '' ']'
+ case "$1" in
+ shift
+ echo -n 'wpa_supplicant: enabling network block 1 -- '
+ wpa_cli enable_network 1
+ /usr/sbin/wpa_cli -p /var/run/wpa_supplicant -i ra0 enable_network 1
+ exit 0
udhcpc (v1.13.3) started
SCANNING 0 0
SCANNING 1 0
SCANNING 2 0
SCANNING 3 0
4WAY_HANDSHAKE 4 0
COMPLETED 21 1
Sending discover...
Sending discover...
Sending discover...
COMPLETED 21 1
DHCP network address discovery failure!
Setting default address of 192.168.2.127...
deleting routers
adding default dns 192.168.2.1
No lease, failing
Alguém já viu um problema como este em que você pode se autenticar, mas qualquer pacote depois disso não passa?
Na verdade sim. Eu tive esse problema com os dongles de WLAN USB baseados em RT3572 e RT5572 e alguns pontos de acesso da Cisco Systems (série comercial WLC 2500), Hirschmann e Symbol Technologies. Resolvi isso temporariamente, alternando para o driver da comunidade rt2800usb OSS, mas esse driver tem um desempenho bastante ruim comparado ao driver do fabricante RTxxxxSTA. Sua solução também funcionou para mim com os dongles baseados em RT3572 e RT5572. Muito obrigado! :)
fonte