diff mbox series

[PULL,04/20] softmmu/vl.c: Disable default NIC if it has not been compiled into the binary

Message ID 20230522115014.1110840-5-thuth@redhat.com
State New
Headers show
Series [PULL,01/20] hw/i386/Kconfig: ISAPC works fine without VGA_ISA | expand

Commit Message

Thomas Huth May 22, 2023, 11:49 a.m. UTC
Don't try to instantiate a default NIC if it is not available (since
this will cause QEMU to abort). Emit a warning instead.

Message-Id: <20230512124033.502654-5-thuth@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 softmmu/vl.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/softmmu/vl.c b/softmmu/vl.c
index 43d3b972da..b0b96f67fa 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -1294,6 +1294,13 @@  static void qemu_disable_default_devices(void)
         default_monitor = 0;
         default_net = 0;
         default_vga = 0;
+    } else {
+        if (default_net && machine_class->default_nic &&
+            !module_object_class_by_name(machine_class->default_nic)) {
+            warn_report("Default NIC '%s' is not available in this binary",
+                        machine_class->default_nic);
+            default_net = 0;
+        }
     }
 }