mohyddin
Posts: 10
Joined: Thu Jan 31, 2019 11:44 pm

dhcpcd and wpa_supplicant clash trying to enable wifi p2p and dhcpcd for pi to operate as GO

Thu Feb 07, 2019 1:54 pm

Hi,

I am trying to enable wifi p2p on pi zero w, and managed to get it working below is my wpa_supplicant.conf file:

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1
country=LB
ap_scan=1
device_name=raspberry
device_type=1-0050F204-1
driver_param=use_p2p_group_interface=1
p2p_go_intent=15
p2p_go_ht40=1
p2p_listen_reg_class=81
p2p_listen_channel=1
p2p_oper_reg_class=81
p2p_oper_channel=1
and have followed https://www.raspberrypi.org/documentati ... s-point.md only the first part "Setting up a Raspberry Pi as an access point in a standalone network (NAT)"

and after completing the steps I am able to connect and ssh into the pi using the obtained ip address, but i loose the p2p configuration
and ifconfig returns:

Code: Select all

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 15072  bytes 1011904 (988.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 15072  bytes 1011904 (988.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 169.254.34.213  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::69ab:8fe5:cd8:b6b0  prefixlen 64  scopeid 0x20<link>
        ether 86:a4:47:f5:e1:60  txqueuelen 1000  (Ethernet)
        RX packets 230  bytes 39660 (38.7 KiB)
        RX errors 0  dropped 6  overruns 0  frame 0
        TX packets 168  bytes 44955 (43.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.4.1  netmask 255.255.255.0  broadcast 192.168.4.255
        inet6 fe80::7d13:d09f:c77e:d8e8  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:e9:6f:91  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 86  bytes 15411 (15.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
and when i run:

Code: Select all

$ sudo wpa_supplicant -B -dd -iwlan0 -Dnl80211 -c /etc/wpa_supplicant/wpa_supplicant.conf
i get:

Code: Select all

wpa_supplicant v2.4
random: Trying to read entropy from /dev/random
Successfully initialized wpa_supplicant
Initializing interface 'wlan0' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'nl80211' ctrl_interface 'N/A' bridge 'N/A'
Configuration file '/etc/wpa_supplicant/wpa_supplicant.conf' -> '/etc/wpa_supplicant/wpa_supplicant.conf'
Reading configuration file '/etc/wpa_supplicant/wpa_supplicant.conf'
ctrl_interface='DIR=/var/run/wpa_supplicant GROUP=netdev'
update_config=1
country='LB'
ap_scan=1
device_name='raspberry'
driver_param='use_p2p_group_interface=1'
p2p_go_intent=15
p2p_go_ht40=1
p2p_listen_reg_class=81
p2p_listen_channel=1
p2p_oper_reg_class=81
p2p_oper_channel=1
rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0
rfkill: initial event: idx=1 type=2 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: Using driver-based off-channel TX
nl80211: Supported vendor command: vendor_id=0x1018 subcmd=1
nl80211: Use separate P2P group interface (driver advertised support)
nl80211: Enable multi-channel concurrent (driver advertised support)
nl80211: use P2P_DEVICE support
nl80211: interface wlan0 in phy phy0
nl80211: Set mode ifindex 3 iftype 3 (AP)
nl80211: Setup AP(wlan0) - device_ap_sme=0 use_monitor=1
nl80211: Create interface iftype 6 (MONITOR)
Failed to create interface mon.wlan0: -95 (Operation not supported)
nl80211: Driver does not support monitor interface type - try to run without it
nl80211: Enable Probe Request reporting nl_preq=0x4eb8a0
nl80211: Register frame type=0x40 (WLAN_FC_STYPE_PROBE_REQ) nl_handle=0x4eb8a0 match=
nl80211: Register frame command failed (type=64): ret=-22 (Invalid argument)
nl80211: Register frame match - hexdump(len=0): [NULL]
nl80211: Failed to enable Probe Request frame reporting in AP mode
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=LB (DFS-FCC)
nl80211: 2402-2482 @ 40 MHz 20 mBm
nl80211: 5170-5250 @ 80 MHz 17 mBm
nl80211: 5250-5330 @ 80 MHz 24 mBm (DFS)
nl80211: 5490-5730 @ 160 MHz 24 mBm (DFS)
nl80211: 5735-5835 @ 80 MHz 30 mBm
nl80211: Added 802.11b mode based on 802.11g information
wlan0: Own MAC address: b8:27:eb:e9:6f:91
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-22 Invalid argument)
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
nl80211: set_key failed; err=-22 Invalid argument)
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=4 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-22 Invalid argument)
wpa_driver_nl80211_set_key: ifindex=3 (wlan0) alg=0 addr=(nil) key_idx=5 set_tx=0 seq_len=0 key_len=0
nl80211: set_key failed; err=-22 Invalid argument)
wlan0: RSN: flushing PMKID list in the driver
nl80211: Flush PMKIDs
wlan0: State: DISCONNECTED -> INACTIVE
TDLS: TDLS operation not supported by driver
TDLS: Driver uses internal link setup
TDLS: Driver does not support TDLS channel switching
wlan0: WPS: UUID based on MAC address: 7c083dac-ace4-5d38-827f-9dc05c4bd962
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
Using existing control interface directory.
ctrl_interface_group=108 (from group name 'netdev')
ctrl_iface bind(PF_UNIX) failed: Address already in use
ctrl_iface exists and seems to be in use - cannot override it
Delete '/var/run/wpa_supplicant/wlan0' manually if it is not used anymore
Failed to initialize control interface 'DIR=/var/run/wpa_supplicant GROUP=netdev'.
You may have another wpa_supplicant process already running or the file was
left by an unclean termination of wpa_supplicant in which case you will need
to manually remove this file before starting wpa_supplicant again.

Failed to add interface wlan0
wlan0: Request to deauthenticate - bssid=00:00:00:00:00:00 pending_bssid=00:00:00:00:00:00 reason=3 state=INACTIVE
TDLS: Tear down peers
wlan0: State: INACTIVE -> 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 delayed sched scan
wlan0: Cancelling scan request
wlan0: Cancelling authentication timeout
Remove interface wlan0 from radio phy0
Remove radio phy0
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
nl80211: Remove monitor interface: refcount=0
nl80211: Remove beacon (ifindex=3)
netlink: Operstate: ifindex=3 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
nl80211: Set mode ifindex 3 iftype 2 (STATION)
nl80211: Teardown AP(wlan0) - device_ap_sme=1 use_monitor=1
everything messes up and ifconfig returns:

Code: Select all

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 15632  bytes 1049184 (1.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 15632  bytes 1049184 (1.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 169.254.34.213  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::69ab:8fe5:cd8:b6b0  prefixlen 64  scopeid 0x20<link>
        ether 86:a4:47:f5:e1:60  txqueuelen 1000  (Ethernet)
        RX packets 286  bytes 42292 (41.3 KiB)
        RX errors 0  dropped 7  overruns 0  frame 0
        TX packets 269  bytes 68563 (66.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether b8:27:eb:e9:6f:91  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 88  bytes 15679 (15.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


How can I enable wifi p2p while also having the dhcp server running so that when i connect from a phone over wifi p2p (wifi direct) as a client i get assigned an ip address?

Ta
Last edited by mohyddin on Thu Feb 07, 2019 2:55 pm, edited 1 time in total.

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5606
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: dhcpd and wpa_supplicant clash trying to enable wifi p2p and dhcpd for pi to operate as GO

Thu Feb 07, 2019 2:41 pm

dhcpd or dhcpcd?

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5606
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: dhcpd and wpa_supplicant clash trying to enable wifi p2p and dhcpd for pi to operate as GO

Thu Feb 07, 2019 2:42 pm

Might be a dumb question, since I don't know how p2p is meant to work, but why are you running wpa_supplicant manually when dhcpcd already launches it?

mohyddin
Posts: 10
Joined: Thu Jan 31, 2019 11:44 pm

Re: dhcpd and wpa_supplicant clash trying to enable wifi p2p and dhcpd for pi to operate as GO

Thu Feb 07, 2019 3:00 pm

ShiftPlusOne wrote:
Thu Feb 07, 2019 2:41 pm
dhcpd or dhcpcd?
Hi, I'm sorry I meant dhcpcd, I edited it, WiFi p2p is WiFi direct basically it works just like normal WiFi, but allows two or more devices to connect without needing to connect to a wireless access point.
It has been very tricky and annoying to work with so far, but I hope to get it working soon.

mohyddin
Posts: 10
Joined: Thu Jan 31, 2019 11:44 pm

Re: dhcpd and wpa_supplicant clash trying to enable wifi p2p and dhcpd for pi to operate as GO

Thu Feb 07, 2019 3:06 pm

ShiftPlusOne wrote:
Thu Feb 07, 2019 2:42 pm
Might be a dumb question, since I don't know how p2p is meant to work, but why are you running wpa_supplicant manually when dhcpcd already launches it?
No such thing as a dumb question!

In the article here: https://www.raspberrypi.org/documentati ... s-point.md
i am supposed to edit /etc/dhcpcd.conf
Go to the end of the file and edit it so that it looks like the following:

interface wlan0
static ip_address=192.168.4.1/24
nohook wpa_supplicant
so as i suppose that enabling p2p is made in wpa_supplicant.conf, then I had to remove the nohook wpa_supplicant
and try to run wpa_supplicant resulting in the problem above..

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5606
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: dhcpd and wpa_supplicant clash trying to enable wifi p2p and dhcpd for pi to operate as GO

Mon Feb 11, 2019 9:36 am

I still don't quite understand.
mohyddin wrote: so as i suppose that enabling p2p is made in wpa_supplicant.conf, then I had to remove the nohook wpa_supplicant
and try to run wpa_supplicant resulting in the problem above..
Removing the nohook like will make dhcpcd run wpa_supplicant and that would clash with running it manually.

mohyddin
Posts: 10
Joined: Thu Jan 31, 2019 11:44 pm

Re: dhcpd and wpa_supplicant clash trying to enable wifi p2p and dhcpd for pi to operate as GO

Mon Feb 11, 2019 2:11 pm

ShiftPlusOne wrote:
Mon Feb 11, 2019 9:36 am
I still don't quite understand.
mohyddin wrote: so as i suppose that enabling p2p is made in wpa_supplicant.conf, then I had to remove the nohook wpa_supplicant
and try to run wpa_supplicant resulting in the problem above..
Removing the nohook like will make dhcpcd run wpa_supplicant and that would clash with running it manually.

I'm sorry if I am not communicating this properly, but what I want to achieve is to have a DHCP server running on the pi while p2p is also working, hope anyone can help me with this!

Return to “Troubleshooting”