pgj / freebsd-wifibox

wifibox: Use Linux to drive your wireless card on FreeBSD
BSD 2-Clause "Simplified" License
159 stars 12 forks source link

wpa_cli times out on all operations but wifibox still routes packets #57

Closed orbitz closed 1 year ago

orbitz commented 1 year ago

Description

Sometimes when I start wifibox, the internet connection works fine but all wpa_cli operations fail. Restarting wifibox does not address the issue. I have to restart the OS. I do not know how to consistently reproduce this.

Host operating system

FreeBSD bsdell 14.0-CURRENT FreeBSD 14.0-CURRENT #7 main-n262232-21ef48af5c0f: Mon Apr 17 21:30:32 AST 2023     root@bsdell:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64

Wireless NIC

ppt0@pci0:2:0:0:        class=0x028000 rev=0x32 hdr=0x00 vendor=0x168c device=0x003e subvendor=0x1a56 subdevice=0x143a
    vendor     = 'Qualcomm Atheros'
    device     = 'QCA6174 802.11ac Wireless Network Adapter'
    class      = network

### Wifibox version

```shell
wifibox version 0.11.0
Disk image checksum: 6ddce1252f5124f6e1c9b2c3373f707641de6d96e29fe917c3bf8ab0a38a680b

### Disk image type and version

wifibox-alpine-20230326

### Changes to the default configuration files

```shell
No changes

Logs

I do not have any logs for this.

Additional context

Add any other context about the problem here that might help the investigation.

Have you tried to turn it on and off?

pgj commented 1 year ago

The wpa_cli tool depends on the Unix Domain Socket (UDS) pass-through feature, which might be the cause why you cannot make a connection to it. When this happens, it is worth to check if the daemon: wifibox-uds-passthru and (more importantly) the socat processes are launched properly. For example:

$ pgrep -lf socat
39949 /usr/local/bin/socat UNIX-RECVFROM:/var/run/wpa_supplicant/wlan0,reuseaddr,fork,unlink-early,user=root,group=0,mode=770 TCP4:10.0.0.1:1200

Problems with that shall be recorded in wifibox.log too, so relevant snippets might be useful to see. You can also check the guest by entering via the console and see if the uds_passthru script is running and socat is also there. For example:

% pgrep -lfa socat
962 /usr/bin/socat TCP4-LISTEN:1200,reuseaddr,bind=10.0.0.1,range=10.0.0.1:255.255.255.0,fork UNIX-SENDTO:/var/run/wpa_supplicant/wlan0,bind=/tmp/tmp.GEHmcI/tmp.INJMeL,unlink-early

When socat is not running on the guest, the messages file shall contain information on the causes (error messages). To find them, search for uds_passthru like this:

% fgrep uds_passthru /var/log/messages
[..]
May  9 23:20:22 wifibox daemon.debug uds_passthru[953]: Configuration: network=10.0.0.1:255.255.255.0, sockets=[path=/var/run/wpa_supplicant/wlan0,user=root,group=0,mode=770,port=1200]
May  9 23:20:22 wifibox daemon.info uds_passthru[953]: Associating 10.0.0.1:1200 (10.0.0.1:255.255.255.0) with /var/run/wpa_supplicant/wlan0 (/tmp/tmp.GEHmcI/tmp.INJMeL)
May  9 23:20:22 wifibox daemon.info uds_passthru[953]: Waiting for PID 968 to stop.
pgj commented 1 year ago

@orbitz ?

orbitz commented 1 year ago

@pgj Sorry, this has not happened to me again in some time so I haven't been able to debug. I'll close this for now and if/when it happens again, add more information.