git: 777f67d8a9c3 - stable/15 - bhyve: Use a blocking socket in the helper process

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 25 Jun 2026 17:24:55 UTC
The branch stable/15 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=777f67d8a9c3ad8f3b90c378cb5c1754a7d4c554

commit 777f67d8a9c3ad8f3b90c378cb5c1754a7d4c554
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-12-22 19:12:34 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-06-25 15:34:06 +0000

    bhyve: Use a blocking socket in the helper process
    
    The send_packet callback does not handle EAGAIN, and on the recv side we
    already use poll() and MSG_DONTWAIT to implement a non-blocking loop.
    
    PR:             291616
    Tested by:      novel
    Fixes:          0e62ebd20172 ("bhyve: Move the slirp backend out into a separate process")
    Differential Revision:  https://reviews.freebsd.org/D54340
    
    (cherry picked from commit daef625cf884dea33d50ad7a0e2da0879a442495)
---
 usr.sbin/bhyve/slirp/slirp-helper.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/usr.sbin/bhyve/slirp/slirp-helper.c b/usr.sbin/bhyve/slirp/slirp-helper.c
index ec0f8a3486e0..36192c590eb1 100644
--- a/usr.sbin/bhyve/slirp/slirp-helper.c
+++ b/usr.sbin/bhyve/slirp/slirp-helper.c
@@ -502,6 +502,8 @@ main(int argc, char **argv)
 
 	memset(&priv, 0, sizeof(priv));
 	priv.sock = sd;
+	if (ioctl(priv.sock, FIONBIO, &(int){0}) == -1)
+		err(1, "ioctl(FIONBIO)");
 	if (pipe2(priv.wakeup, O_CLOEXEC | O_NONBLOCK) != 0)
 		err(1, "pipe2");