On 11/26/25 18:03, Roman Bogorodskiy wrote:
SLIRP networking in bhyve doesn't support MAC and IP addresses configuration, so update the validation code to check that these options are not specified.
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> --- src/bhyve/bhyve_domain.c | 17 +++++++++++++- .../bhyvexml2argv-slirp-ip.xml | 22 +++++++++++++++++++ .../bhyvexml2argv-slirp-mac-addr.xml | 22 +++++++++++++++++++ tests/bhyvexml2argvtest.c | 2 ++ 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-slirp-ip.xml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-slirp-mac-addr.xml
diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c index 4c9ed29333..5c1ed86df6 100644 --- a/src/bhyve/bhyve_domain.c +++ b/src/bhyve/bhyve_domain.c @@ -325,6 +325,22 @@ bhyveDomainDeviceDefValidate(const virDomainDeviceDef *dev,
break; } + case VIR_DOMAIN_DEVICE_NET: { + virDomainNetDef *net = dev->data.net; + + if (net->type == VIR_DOMAIN_NET_TYPE_USER) { + if (!net->mac_generated) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("setting MAC address for SLIRP networking is not supported")); + return -1;
This is a bit unfortunate as many of our public APIs (e.g. virDomainDetachDevice()) try to match <interface/> using its MAC address first. OTOH, they can find a match using other values specific to individual device and we specifically document that device XML should be passed full.
+ } + if (net->guestIP.nips) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("setting IP addresses for SLIRP networking is not supported")); + return -1; + } + } + }
Michal