Date: Thu, 07 Sep 2023 17:04:54 +0000 From: bugzilla-noreply@freebsd.org To: virtualization@FreeBSD.org Subject: [Bug 273557] Regression preventing bhyve from running inside a jail without IP after f74147e26999838e03a522bf59ea33bef470d356) breaks support for jailing bhyve with IPv4 and IPv6 disabled. Patch included. Message-ID: <bug-273557-27103-Qx8Ez9db8v@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-273557-27103@https.bugs.freebsd.org/bugzilla/> References: <bug-273557-27103@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D273557 --- Comment #6 from crest@rlwinm.de --- (In reply to Bjoern A. Zeeb from comment #4) The untested patch would still attempt to create a socket (which can fail), closing the socket could be factored out (keep only the last close(s), but = put a label before and after it). It will allow bhyve to start, but bhyve will = fail to bring up the tap/vmnet interface on its own if it can't create an IP soc= ket (either IPv4 or IPv6). For example if bhyve is started inside very restrict= ive jail with ip=3Ddisabled and ip6=3Ddisabled. In this case bhyve will start b= ut the tap/vmnet device will stay in its default link state forcing users to either set sysctl net.link.tap.up_on_open=3D1 to change the default link state for= all tap/vmnet interface from DOWN to UP or have a wrapper poll the tap/vmnet de= vice aggressive enough until bhyve has opened it to bring the link state up befo= re the guest notices it. This is complicated by the fact that bhyve(8) exists = if the guest requests a reboot. While I've always run my bhyve hosts with net.link.tap.up_on_open=3D1 bhyve users shouldn't be forced to do change th= eir global system configuration. The corner case I ran into is clearly a bug th= at should be fixed. I see no advantage to addressing only one half of the bug = by still using an IP socket, but continuing if the socket creation or ioctl()s fail. Processes running inside a jail with both IPv4 and IPv6 disabled can't be create new IP sockets of either IP version. The only way for bhyve to bring= up the tap/vmnet device from inside such a jail is to use the ioctl(VMIO_SIOCSIFFLAGS) on the tap/vmnet device. It's also the only place = in bhyve that I found with a quick `grep -r` which creates IP sockets. From my understanding ioctl(VMIO_SIOCSIFFLAGS) covers all cases (inside a jail and outside), avoids creating and destroying a socket, saves a few syscalls, removes a (theoretical) race condition, removes failure cases that have to = be handled (even if only to report and ignore them). Am I overlooking a downside to using ioctl(VMIO_SIOCSIFFLAGS) on the tap/vm= net device and getting rid of the IP socket and the variables holding the socket file descriptor number and struct passed to ioctl()s on the socket? --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-273557-27103-Qx8Ez9db8v>