
On 09/12/2014 06:33 AM, Chen Fan wrote:
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]")) {\
I think we need a 'virSocketAddrIsLocalhost' function similar to virSocketAddrIsWildcard, which would check any numeric represnation of the address: if (STRPREFIX(cfg->migrateHost, "localhost") || virSocketAddrIsLocalhost(cfg->migrateHost))
+ virReportError(VIR_ERR_CONF_SYNTAX, "%s", + _("migration_host must be a valid address or hostname"));
Something more specific, like: "migration_host must not be localhost" is more user-friendly. Jan
+ goto cleanup; + } + } + GET_VALUE_STR("migration_address", cfg->migrationAddress);
GET_VALUE_BOOL("log_timestamp", cfg->logTimestamp);