NetworkManager interfers with wpa_supplicant

206 views Asked by At

I'm trying to build an app in C++ to connect 2 Linux devices via WiFi Direct using WPA_Supplicant. Trying to do that in the wpa_cli (with wlo1 interface), I got to the point where with NetworkManager up, and trying to connect two devices, the output logs from wpa_supplicant are:

P2P-GO-NEG-SUCCESS role=client freq=5805 ht40=0 peer_dev=00:11:22:33:44:ff peer_iface=00:11:22:33:44:ff wps_method=PBC
p2p-wlo1-1: WPS-PBC-ACTIVE
p2p-wlo1-1: SME: Trying to authenticate with 00:11:22:33:44:ff (SSID='DIRECT-B8' freq=5805 MHz)
p2p-wlo1-1: Trying to associate with 00:11:22:33:44:ff (SSID='DIRECT-B8' freq=5805 MHz)
p2p-wlo1-1: Associated with 00:11:22:33:44:ff
p2p-wlo1-1: CTRL-EVENT-EAP-STARTED EAP authentication started
p2p-wlo1-1: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
p2p-wlo1-1: CTRL-EVENT-EAP-PROPOSED-METHOD vendor=14122 method=1
p2p-wlo1-1: CTRL-EVENT-EAP-METHOD EAP vendor 14122 method 1 (WSC) selected
p2p-wlo1-1: WPS-CRED-RECEIVED
p2p-wlo1-1: WPS-SUCCESS
P2P-GROUP-FORMATION-SUCCESS
p2p-wlo1-1: CTRL-EVENT-EAP-FAILURE EAP authentication failed
p2p-wlo1-1: CTRL-EVENT-DISCONNECTED bssid=00:11:22:33:44:ff reason=3 locally_generated=1
p2p-wlo1-1: CTRL-EVENT-DSCP-POLICY clear_all
p2p-wlo1-1: SME: Trying to authenticate with 00:11:22:33:44:ff (SSID='DIRECT-B8'  freq=5805 MHz)
P2P-GROUP-FORMATION-FAILURE
p2p-wlo1-1: CTRL-EVENT-DSCP-POLICY clear_all
P2P-GROUP-REMOVED p2p-wlo1-1 client reason=FORMATION_FAILED

It looks like the group is being formed but it get shutted down right after the creation, and I don't get the reason. Also, I discovered that i can succesfully create a group between two devices by setting the option inside wpa_cli

set p2p_no_group_iface 1

on both devices before the find / connect thing. My assumption is that NetworkManager interfers with creating a new virtual interface for p2p, so it shuts the interface down and the group created is removed, is that possible? My goal is to build this app while NetworkManager is active and not stopping it and manually starting wpa_supplicant with a custom .conf file.

1

There are 1 answers

0
thaller On

I don't think that you can use wpa_supplicant at the same time as NetworkManager (for the same interface, for distinct interfaces it probably works).

Tell NetworkManager to stay away, for example with nmcli device set wlan0 managed no. This command just uses the D-Bus API, so you can also make a request on D-Bus (although, that will be more cumbersome to find the right D-Bus object).

and not stopping it and manually starting wpa_supplicant with a custom .conf file.

Well, if you start wpa_supplicant without D-Bus interface (no -u option), then NetworkManager cannot/won't talk with it.