sysprog21 / vwifi

A virtual wireless device driver for Linux
MIT License
203 stars 39 forks source link

Can't get wifi asssociated in QEMU #71

Open lone0 opened 1 month ago

lone0 commented 1 month ago

Hi all,

I followed the Testing environment (virtio) but can't get the two QEMU VM associated with each other.

Host is Ubuntu 20 and the two QEMU VM are built from buildroot 2024.05. The VM kernel is from the same buildroot, version 6.6.18. I enabled cfg80211 in it and built vwifi against that kernel.

When start hostapd in vm1 I got this:

# insmod vwifi.ko station=1
# ifconfig vw0 up
# ip addr add 192.168.1.1/24 dev vw0
# hostapd -i vw0 -B hostapd.conf
Failed to create interface mon.vw0: -95 (Operation not supported)
rfkill: Cannot open RFKILL control device
vw0: interface state UNINITIALIZED->ENABLED
vw0: AP-ENABLED

On vm2 it looked good, but vw0 never connected:

# insmod vwifi.ko station=1
# ip link set vw0 up
# ip addr add 192.168.1.2/24 dev vw0
# wpa_supplicant -i vw0 -B -c wpa_supplicant.conf
Successfully initialized wpa_supplicant
rfkill: Cannot open RFKILL control device
#
# iw dev vw0 link
Not connected.
#

Both QEMU are started like below: sudo /home/zhenxi/buildroot/qemu-x86_64/output/host/bin/qemu-system-x86_64 -kernel bzImage -drive file=rootfs.ext2 -nographic -append "console=ttyS0" -append root=/dev/sda -netdev tap,id=tap0,ifname=tap0,script=no -device virtio-net-pci,netdev=tap0,mac=00:11:22:00:00:00,mrg_rxbuf=off -serial mon:stdio with separate rootfs and their own tap number/mac address accordingly

On host, there are br0 and tap0/1/2 like this:

$ ip link show master br0
3: tap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP mode DEFAULT group default qlen 1000
    link/ether 4e:2d:de:5f:95:17 brd ff:ff:ff:ff:ff:ff
4: tap1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP mode DEFAULT group default qlen 1000
    link/ether 0e:08:63:4c:8e:f7 brd ff:ff:ff:ff:ff:ff
5: tap2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop master br0 state DOWN mode DEFAULT group default qlen 1000
    link/ether 32:ea:5a:04:e0:95 brd ff:ff:ff:ff:ff:ff

$ ip link show br0
6: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 0e:08:63:4c:8e:f7 brd ff:ff:ff:ff:ff:ff