]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
conf: Check whether migration_address is localhost
authorChen Fan <chen.fan.fnst@cn.fujitsu.com>
Tue, 7 Oct 2014 04:07:32 +0000 (12:07 +0800)
committerJán Tomko <jtomko@redhat.com>
Wed, 15 Oct 2014 07:25:33 +0000 (09:25 +0200)
When enabling the migration_address option, by default it is
set to "127.0.0.1", but it's not a valid address for migration.
so we should add verification and set the default migration_address
to "0.0.0.0".

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu.conf
src/qemu/qemu_conf.c
src/qemu/test_libvirtd_qemu.aug.in

index 92ca7154a6d5b12b86f403db213b0239c6673e27..c6db5689e0e1ffa8700049b9f5714e9987aac80b 100644 (file)
 
 # Override the listen address for all incoming migrations. Defaults to
 # 0.0.0.0, or :: if both host and qemu are capable of IPv6.
-#migration_address = "127.0.0.1"
+#migration_address = "0.0.0.0"
 
 
 # The default hostname or IP address which will be used by a migration
index e2a3505ed102d138b6853023facc2793727032a7..1ae90ffd7fa33af0a8694e745b87e564791ee1d7 100644 (file)
@@ -719,6 +719,16 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
     }
 
     GET_VALUE_STR("migration_address", cfg->migrationAddress);
+    virStringStripIPv6Brackets(cfg->migrationAddress);
+    if (cfg->migrationAddress &&
+        (STRPREFIX(cfg->migrationAddress, "localhost") ||
+         virSocketAddrIsNumericLocalhost(cfg->migrationAddress))) {
+        virReportError(VIR_ERR_CONF_SYNTAX,
+                       _("migration_address must not be the address of"
+                         " the local machine: %s"),
+                       cfg->migrationAddress);
+        goto cleanup;
+    }
 
     GET_VALUE_BOOL("log_timestamp", cfg->logTimestamp);
 
index d2bc2c04500c36a6e94df8485ea3f201d7d33f62..30fd27e4625832f92fb175f3351b35836e69e4cf 100644 (file)
@@ -69,7 +69,7 @@ module Test_libvirtd_qemu =
 { "keepalive_interval" = "5" }
 { "keepalive_count" = "5" }
 { "seccomp_sandbox" = "1" }
-{ "migration_address" = "127.0.0.1" }
+{ "migration_address" = "0.0.0.0" }
 { "migration_host" = "host.example.com" }
 { "migration_port_min" = "49152" }
 { "migration_port_max" = "49215" }