From: Marc-André Lureau <marcandre.lureau(a)redhat.com>
A slirp helper is a process that provides user-mode networking through
a unix domain socket. It is expected to follow the following
specification:
https://gitlab.freedesktop.org/slirp/libslirp-rs/blob/master/src/bin/READ...
Signed-off-by: Marc-André Lureau <marcandre.lureau(a)redhat.com>
---
m4/virt-driver-qemu.m4 | 5 +++++
src/qemu/libvirtd_qemu.aug | 1 +
src/qemu/qemu.conf | 3 +++
src/qemu/qemu_conf.c | 5 +++++
src/qemu/qemu_conf.h | 1 +
src/qemu/test_libvirtd_qemu.aug.in | 1 +
6 files changed, 16 insertions(+)
diff --git a/m4/virt-driver-qemu.m4 b/m4/virt-driver-qemu.m4
index 1bc1755620..b050411b7b 100644
--- a/m4/virt-driver-qemu.m4
+++ b/m4/virt-driver-qemu.m4
@@ -110,6 +110,11 @@ AC_DEFUN([LIBVIRT_DRIVER_CHECK_QEMU], [
[/usr/bin:/usr/libexec])
AC_DEFINE_UNQUOTED([QEMU_DBUS_DAEMON], ["$QEMU_DBUS_DAEMON"],
[QEMU dbus daemon])
+ AC_PATH_PROG([QEMU_SLIRP_HELPER], [slirp-helper],
+ [/usr/bin/slirp-helper],
+ [/usr/bin:/usr/libexec])
+ AC_DEFINE_UNQUOTED([QEMU_SLIRP_HELPER], ["$QEMU_SLIRP_HELPER"],
+ [QEMU slirp helper])
])
AC_DEFUN([LIBVIRT_DRIVER_RESULT_QEMU], [
diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug
index ba4caabc42..e989fa8623 100644
--- a/src/qemu/libvirtd_qemu.aug
+++ b/src/qemu/libvirtd_qemu.aug
@@ -90,6 +90,7 @@ module Libvirtd_qemu =
| str_entry "bridge_helper"
| str_entry "pr_helper"
| str_entry "dbus_daemon"
+ | str_entry "slirp_helper"
| bool_entry "set_process_name"
| int_entry "max_processes"
| int_entry "max_files"
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index 26bab39123..b8408b2f79 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -823,6 +823,9 @@
# used whenever <reservations/> are enabled for SCSI LUN devices.
#pr_helper = "/usr/bin/qemu-pr-helper"
+# Path to the SLIRP networking helper.
+#slirp_helper = "/usr/bin/slirp-helper"
+
# Path to the dbus-daemon
#dbus_daemon = "/usr/bin/dbus-daemon"
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 5f6f93d828..a986feecea 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -286,6 +286,7 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
if (VIR_STRDUP(cfg->bridgeHelperName, QEMU_BRIDGE_HELPER) < 0 ||
VIR_STRDUP(cfg->prHelperName, QEMU_PR_HELPER) < 0 ||
+ VIR_STRDUP(cfg->slirpHelperName, QEMU_SLIRP_HELPER) < 0 ||
VIR_STRDUP(cfg->dbusDaemonName, QEMU_DBUS_DAEMON) < 0)
goto error;
@@ -377,6 +378,7 @@ static void virQEMUDriverConfigDispose(void *obj)
VIR_FREE(cfg->hugetlbfs);
VIR_FREE(cfg->bridgeHelperName);
VIR_FREE(cfg->prHelperName);
+ VIR_FREE(cfg->slirpHelperName);
VIR_FREE(cfg->dbusDaemonName);
VIR_FREE(cfg->saveImageFormat);
@@ -674,6 +676,9 @@ virQEMUDriverConfigLoadProcessEntry(virQEMUDriverConfigPtr cfg,
if (virConfGetValueString(conf, "pr_helper", &cfg->prHelperName)
< 0)
return -1;
+ if (virConfGetValueString(conf, "slirp_helper",
&cfg->slirpHelperName) < 0)
+ return -1;
+
if (virConfGetValueString(conf, "dbus_daemon", &cfg->dbusDaemonName)
< 0)
return -1;
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index c87cb8bc41..003851d2a7 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -153,6 +153,7 @@ struct _virQEMUDriverConfig {
char *bridgeHelperName;
char *prHelperName;
char *dbusDaemonName;
+ char *slirpHelperName;
bool macFilter;
diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qemu.aug.in
index e135869717..1bb3de3edc 100644
--- a/src/qemu/test_libvirtd_qemu.aug.in
+++ b/src/qemu/test_libvirtd_qemu.aug.in
@@ -103,6 +103,7 @@ module Test_libvirtd_qemu =
}
{ "memory_backing_dir" = "/var/lib/libvirt/qemu/ram" }
{ "pr_helper" = "/usr/bin/qemu-pr-helper" }
+{ "slirp_helper" = "/usr/bin/slirp-helper" }
{ "dbus_daemon" = "/usr/bin/dbus-daemon" }
{ "swtpm_user" = "tss" }
{ "swtpm_group" = "tss" }
--
2.22.0.214.g8dca754b1e