Lost connection using bhyve + netmap/VALE

From: Jonas Lopes <jonasbsd_at_gmail.com>
Date: Wed, 05 Apr 2023 21:21:36 UTC
Hello everybody.

I had a lot of problems with the vm-bhyve NAT network on 14-CURRENT. That's
why I looked for alternatives and took the opportunity to study Netgraph,
netmap/VALE with bhyve(8).

However, I think I found other bugs. When I virtualize Windows using bhyve
with TAP, the system works perfectly.

bhyve -c 2 -m 4G -w -H \
> -s 0, hostbridge \
> -s 2,nvme,/vm/windows/disk0.img \
> -s 5,virtio-net,tap0 \
> -s 29,fbuf,tcp=0.0.0.0:5900,w=1280,h=720,no \
> -s 30,xhci,tablet \
> -s 31,lpc -l com1,stdio \
> -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
> Windows
>

But when I virtualize Windows using bhyve with netmap/VALE, at some point
the laptop loses connectivity. I am completely without a network. Within
VALE connectivity continues, but everything else loses connectivity.
Including the internet.

-s 5,virtio-net,vale0:windows \


If I restart wlan0's network service, the computer freezes. If I delete the
VALE connection with wlan0, after the PC loses connectivity, it crashes too.

In a moment I follow the steps below:

- 1. After some time away from the PC, there is a disconnection with the
> WiFi network. It looks like it's connected, but it doesn't work;
>
> - 2. I enter the command: service netif restart wlan0
>
> - 3. The network works again;
>
> - 4. When I delete a VALE network that was connected to wlan0 before
> disconnecting the network, FreeBSD freezes;
>

I've tested it several times, and the same thing happens.

FreeBSD version:

% uname -a
> FreeBSD mithrandir 14.0-CURRENT FreeBSD 14.0-CURRENT #5
> main-n261959-cfccc7f30a01: Mon Apr  3 07:57:49 -03 2023     root@mithrandir:/usr/obj/usr/src/amd64.amd64/sys/GENERIC
> amd64
>

Some details:

- I don't have another network card. I'm on Ideapad s145. It does not have
a cable network card.
- In a moment it crashes completely. In another it freezes, but I notice
that the keyboard is still working. I go to another tty even without an
image, I enter with the root user and reboot. It works!
- I tested it with a USB/Network and so far it only crashed 1 time. Unlike
WiFi, which freezes a few minutes (sometimes hours) after creating the VALE
connections with the virtual machine.

-- 
Jonas Lopes <jonasbsd gmail.com>