title: WPA supplicant ERROR WPA: 4-Way Handshake failed in WiFi Direct setup
body: <p>I am trying to set up WiFi Direct between two linux machines. I am using Atheros 9k cards to set up the connections. We have a problem in the process which I hope you guys can help me.
  When I run WPA Supplicant in both of the parts, I get this:</p>
  
  <pre><code>wpa_supplicant -B -D nl80211 -i wlan0 -cp2p.conf -d 
  wpa_supplicant v2.2-devel
  random: Trying to read entropy from /dev/random
  Successfully initialized wpa_supplicant
  Initializing interface 'wlan0' conf 'p2p.conf' driver 'nl80211' ctrl_interface 'N/A' bridge 'N/A'
  Configuration file 'p2p.conf' -&gt; '/root/p2p.conf'
  Reading configuration file '/root/p2p.conf'
  ctrl_interface='/var/run/wpa_supplicant'
  ap_scan=2
  update_config=1
  device_name='giulia118'
  p2p_go_ht40=1
  Priority group 0
  id=0 ssid='Direct_Network'
  nl80211: Could not add multicast membership for vendor events: -2 (No such file or  directory)
  rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0
  rfkill: initial event: idx=1 type=1 op=0 soft=0 hard=0
  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:6
  nl80211: Using driver-based off-channel TX
  nl80211: interface wlan0 in phy phy0
  nl80211: Set mode ifindex 4 iftype 2 (STATION)
  nl80211: Subscribe to mgmt frames with non-AP handle 0x9fa4380
  nl80211: Register frame type=0xd0 nl_handle=0x9fa4380 match=040a
  nl80211: Register frame type=0xd0 nl_handle=0x9fa4380 match=040b
  nl80211: Register frame type=0xd0 nl_handle=0x9fa4380 match=040c
  nl80211: Register frame type=0xd0 nl_handle=0x9fa4380 match=040d
  nl80211: Register frame type=0xd0 nl_handle=0x9fa4380 match=090a
  nl80211: Register frame type=0xd0 nl_handle=0x9fa4380 match=090b
  nl80211: Register frame type=0xd0 nl_handle=0x9fa4380 match=090c
  nl80211: Register frame type=0xd0 nl_handle=0x9fa4380 match=090d
  nl80211: Register frame type=0xd0 nl_handle=0x9fa4380 match=0409506f9a09
  nl80211: Register frame type=0xd0 nl_handle=0x9fa4380 match=7f506f9a09
  nl80211: Register frame type=0xd0 nl_handle=0x9fa4380 match=06
  nl80211: Register frame type=0xd0 nl_handle=0x9fa4380 match=0a07
  nl80211: Register frame type=0xd0 nl_handle=0x9fa4380 match=0a11
  netlink: Operstate: ifindex=4 linkmode=1 (userspace-control), operstate=5 (IF_OPER_DORMANT)
  nl80211: driver param='(null)'
  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 @ 40 MHz 20 mBm (no IR)
  nl80211: 5735-5835 @ 40 MHz 20 mBm (no IR)
  nl80211: Added 802.11b mode based on 802.11g information
  wlan0: Own MAC address: 04:f0:21:06:1d:14
  wpa_driver_nl80211_set_key: ifindex=4 (wlan0) alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
  wpa_driver_nl80211_set_key: ifindex=4 (wlan0) alg=0 addr=(nil) key_idx=1 set_tx=0  seq_len=0 key_len=0
  wpa_driver_nl80211_set_key: ifindex=4 (wlan0) alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0
  wpa_driver_nl80211_set_key: ifindex=4 (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: Setting scan request: 0.100000 sec
  wlan0: WPS: UUID based on MAC address: 94f8bf7f-bad8-5fc8-87c2-05c3afbed265
  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
  P2P: Own listen channel: 6
  P2P: Random operating channel: 81:6
  P2P: Add operating class 81
  P2P: Channels - hexdump(len=11): 01 02 03 04 05 06 07 08 09 0a 0b
  P2P: Add operating class 115
  P2P: Channels - hexdump(len=4): 24 28 2c 30
  P2P: Add operating class 124
  P2P: Channels - hexdump(len=4): 95 99 9d a1
  P2P: Add operating class 116
  P2P: Channels - hexdump(len=2): 24 2c
  P2P: Add operating class 117
  P2P: Channels - hexdump(len=2): 28 30
  P2P: Add operating class 126
  P2P: Channels - hexdump(len=2): 95 9d
  P2P: Add operating class 127
  P2P: Channels - hexdump(len=2): 99 a1
  P2P: initialized
  P2P: channels: 81:1,2,3,4,5,6,7,8,9,10,11 115:36,40,44,48 124:149,153,157,161 116:36,44 117:40,48 126:149,157 127:153,161
  P2P: cli_channels:
  wlan0: Added interface wlan0
  wlan0: State: DISCONNECTED -&gt; DISCONNECTED
  nl80211: Set wlan0 operstate 0-&gt;0 (DORMANT)
  netlink: Operstate: ifindex=4 linkmode=-1 (no change), operstate=5 (IF_OPER_DORMANT)
  Daemonize..
  </code></pre>
  
  <p>Then I run wpa_cli and I use the commands for create a p2p group in pbc (Pusg button Control), and the final messages of the failed connection are:</p>
  
  <p>1st Device:</p>
  
  <pre><code>&lt;3&gt;WPS-AP-AVAILABLE-PBC 
  &lt;3&gt;SME: Trying to authenticate with 04:f0:21:06:1d:1f (SSID='DIRECT-Mj' freq=2412 MHz)
  &lt;3&gt;Trying to associate with 04:f0:21:06:1d:1f (SSID='DIRECT-Mj' freq=2412 MHz)
  &lt;3&gt;Associated with 04:f0:21:06:1d:1f
  &lt;3&gt;CTRL-EVENT-EAP-STARTED EAP authentication started
  &lt;3&gt;CTRL-EVENT-EAP-STATUS status='started' parameter=''
  &lt;3&gt;CTRL-EVENT-EAP-PROPOSED-METHOD vendor=14122 method=1
  &lt;3&gt;CTRL-EVENT-EAP-STATUS status='accept proposed method' parameter='WSC'
  &lt;3&gt;CTRL-EVENT-EAP-METHOD EAP vendor 14122 method 1 (WSC) selected
  &lt;3&gt;WPS-CRED-RECEIVED 
  &lt;3&gt;WPS-SUCCESS 
  &lt;3&gt;P2P-GROUP-FORMATION-SUCCESS 
  &lt;3&gt;CTRL-EVENT-EAP-STATUS status='completion' parameter='failure'
  &lt;3&gt;CTRL-EVENT-EAP-FAILURE EAP authentication failed
  &lt;3&gt;CTRL-EVENT-DISCONNECTED bssid=04:f0:21:06:1d:1f reason=3 locally_generated=1
  &lt;3&gt;SME: Trying to authenticate with 04:f0:21:06:1d:1f (SSID='DIRECT-Mj' freq=2412 MHz)
  &lt;3&gt;Trying to associate with 04:f0:21:06:1d:1f (SSID='DIRECT-Mj' freq=2412 MHz)
  &lt;3&gt;CTRL-EVENT-REGDOM-CHANGE init=DRIVER type=WORLD
  &lt;3&gt;Associated with 04:f0:21:06:1d:1f
  &lt;3&gt;CTRL-EVENT-DISCONNECTED bssid=04:f0:21:06:1d:1f reason=2
  &lt;3&gt;WPA: 4-Way Handshake failed - pre-shared key may be incorrect
  &lt;3&gt;CTRL-EVENT-REGDOM-CHANGE init=DRIVER type=WORLD
  &lt;3&gt;CTRL-EVENT-SCAN-STARTED 
  &lt;3&gt;CTRL-EVENT-SCAN-RESULTS 
  &lt;3&gt;WPS-AP-AVAILABLE 
  &lt;3&gt;P2P-GROUP-FORMATION-FAILURE 
  &lt;3&gt;P2P-GROUP-REMOVED wlan0 client reason=FORMATION_FAILED
  </code></pre>
  
  <p>2nd Device:</p>
  
  <pre><code>&lt;3&gt;AP-ENABLED 
  &lt;3&gt;CTRL-EVENT-CONNECTED - Connection to 04:f0:21:06:1d:1f completed [id=1 id_str=]
  &lt;3&gt;P2P-GROUP-STARTED wlan0 GO ssid="DIRECT-Mj" freq=2412 passphrase="ZPHbkRAf"   go_dev_addr=04:f0:21:06:1d:1f
  wps_pbc
  &gt; OK
  &lt;3&gt;WPS-PBC-ACTIVE 
  &lt;3&gt;P2P-PROV-DISC-PBC-REQ 04:f0:21:06:1d:14 p2p_dev_addr=04:f0:21:06:1d:14  pri_dev_type=1-0050F204-1 name='giulia118' config_methods=0x108 dev_capab=0x21  group_capab=0x0 group=wlan0
  &lt;3&gt;WPS-ENROLLEE-SEEN 04:f0:21:06:1d:14 94f8bf7f-bad8-5fc8-87c2-05c3afbed265 1-0050F204-1 0x2108 4 1 [giulia118]
  &lt;3&gt;CTRL-EVENT-EAP-STARTED 04:f0:21:06:1d:14
  &lt;3&gt;CTRL-EVENT-EAP-PROPOSED-METHOD vendor=0 method=1
  &lt;3&gt;CTRL-EVENT-EAP-PROPOSED-METHOD vendor=14122 method=254
  &lt;3&gt;WPS-REG-SUCCESS 04:f0:21:06:1d:14 94f8bf7f-bad8-5fc8-87c2-05c3afbed265
  &lt;3&gt;WPS-PBC-DISABLE 
  &lt;3&gt;WPS-SUCCESS 
  &lt;3&gt;CTRL-EVENT-EAP-FAILURE 04:f0:21:06:1d:14
  &lt;3&gt;WPS-ENROLLEE-SEEN 04:f0:21:06:1d:14 94f8bf7f-bad8-5fc8-87c2-05c3afbed265 1-0050F204-1 0x2108 0 0 [giulia118]
  </code></pre>
  
  <p>The content of my configuration (p2p.conf) file is: </p>
  
  <p>1st Device:</p>
  
  <pre><code>ctrl_interface=/var/run/wpa_supplicant
  
  ap_scan=2
  fast_reauth=1
  update_config=1
  device_name=giulia116
  device_type=1-0050F204-1
  p2p_go_ht40=1
  
  network={
      ssid="Direct_Network"
      psk="12345678"
      proto=RSN WPA
      key_mgmt=WPA-PSK
      pairwise=CCMP TKIP
      group=CCMP TKIP
  }
  </code></pre>
  
  <p>2nd Device:</p>
  
  <pre><code>ctrl_interface=/var/run/wpa_supplicant
  ap_scan=2
  update_config=1
  device_name=giulia118
  device_type=1-0050F204-1
  p2p_go_ht40=1
  
  network={
      ssid="Direct_Network"
      psk="12345678"
      key_mgmt=WPA-PSK
      group=CCMP TKIP
  }
  </code></pre>
  
  <p>ifconfig:</p>
  
  <pre><code>eth0      Link encap:Ethernet  HWaddr 00:0d:b9:2e:1b:88  
            inet addr:192.168.97.116  Bcast:192.168.97.255  Mask:255.255.255.0
            inet6 addr: fe80::20d:b9ff:fe2e:1b88/64 Scope:Link
            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
            RX packets:2949 errors:0 dropped:0 overruns:0 frame:0
            TX packets:1840 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:1000 
            RX bytes:321032 (321.0 KB)  TX bytes:268766 (268.7 KB)
            Interrupt:10 Base address:0xe000 
  
  eth1      Link encap:Ethernet  HWaddr 00:0d:b9:2e:1b:89  
            inet addr:172.16.0.235  Bcast:172.16.0.255  Mask:255.255.255.0
            inet6 addr: fe80::20d:b9ff:fe2e:1b89/64 Scope:Link
            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
            RX packets:163951 errors:0 dropped:0 overruns:0 frame:0
            TX packets:35 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:1000 
            RX bytes:17016272 (17.0 MB)  TX bytes:4093 (4.0 KB)
            Interrupt:15 
  
  lo        Link encap:Local Loopback  
            inet addr:127.0.0.1  Mask:255.0.0.0
            inet6 addr: ::1/128 Scope:Host
            UP LOOPBACK RUNNING  MTU:16436  Metric:1
            RX packets:0 errors:0 dropped:0 overruns:0 frame:0
            TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:0 
            RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
  
  mon.wlan0 Link encap:UNSPEC  HWaddr 04-F0-21-06-1D-1F-30-30-00-00-00-00-00-00-00-00  
            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
            RX packets:716 errors:0 dropped:0 overruns:0 frame:0
            TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:1000 
            RX bytes:104534 (104.5 KB)  TX bytes:0 (0.0 B)
  
  wlan0     Link encap:Ethernet  HWaddr 04:f0:21:06:1d:1f  
            inet6 addr: fe80::6f0:21ff:fe06:1d1f/64 Scope:Link
            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
            RX packets:13 errors:0 dropped:0 overruns:0 frame:0
            TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:1000 
            RX bytes:2154 (2.1 KB)  TX bytes:576 (576.0 B)
  </code></pre>
  
  <p>.config :</p>
  
  <pre><code>CONFIG_DRIVER_NL80211=y
  CONFIG_READLINE=y
  CONFIG_CTRL_IFACE=y
  CONFIG_WPS=y
  CONFIG_WPS2=y
  CONFIG_P2P=y
  CONFIG_AP=y
  
  #CONFIG_DRIVER_WEXT=y
  #CONFIG_DRIVER_BSD=y
  #CONFIG_DRIVER_NDIS=y
  CONFIG_IEEE8021X_EAPOL=y
  #CONFIG_EAP_MD5=y
  #CONFIG_EAP_MSCHAPV2=y
  CONFIG_EAP_TLS=y
  CONFIG_EAP_PEAP=y
  #CONFIG_EAP_TTLS=y
  #CONFIG_EAP_GTC=y
  #CONFIG_EAP_OTP=y
  #CONFIG_EAP_SIM=y
  #CONFIG_EAP_AKA=y
  CONFIG_EAP_PSK=y
  #CONFIG_EAP_SAKE=y
  #CONFIG_EAP_GPSK=y
  #CONFIG_EAP_PAX=y
  CONFIG_EAP_LEAP=y
  #CONFIG_EAP_IKEV2=y
  #CONFIG_PCSC=y 
  </code></pre>
  
  <p>The error seems to be related to the  “4-Way Handshake” failure.  Could it be that the pre-shared key is incorrect? Why I have a “GROUP REMOVED” ?
  I would appreciate any suggestion regarding the matter.</p>
  
  <p>Thank you all in advance!</p>