[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH v1 2/3] conf: Check migration_host is localhost or not during restart



Signed-off-by: Chen Fan <chen fan fnst cn fujitsu com>
---
 src/qemu/qemu_conf.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index ac10b64..013f3de 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -707,6 +707,17 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
     GET_VALUE_LONG("seccomp_sandbox", cfg->seccompSandbox);
 
     GET_VALUE_STR("migration_host", cfg->migrateHost);
+    if (cfg->migrateHost) {
+        if (STRPREFIX(cfg->migrateHost, "localhost") ||
+            STREQ(cfg->migrateHost, "127.0.0.1") ||
+            STREQ(cfg->migrateHost, "::1") ||
+            STREQ(cfg->migrateHost, "[::1]")) {
+            virReportError(VIR_ERR_CONF_SYNTAX, "%s",
+                           _("migration_host must be a valid address or hostname"));
+            goto cleanup;
+        }
+    }
+
     GET_VALUE_STR("migration_address", cfg->migrationAddress);
 
     GET_VALUE_BOOL("log_timestamp", cfg->logTimestamp);
-- 
1.9.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]