]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Handle kernels with no ipv6 support
authorMark McLoughlin <markmc@redhat.com>
Mon, 10 Aug 2009 10:16:37 +0000 (11:16 +0100)
committerMark McLoughlin <markmc@redhat.com>
Mon, 10 Aug 2009 10:19:42 +0000 (11:19 +0100)
If the ipv6 kernel module is not loaded, then we get this when starting
a virtual network:

  libvir: Network Config error :
  cannot enable /proc/sys/net/ipv6/conf/virbr0/disable_ipv6:
  No such file or directory

If disable_ipv6 is not present, we should just merrily continue on our
way.

* src/network_driver.c: make networkDisableIPV6() not fail if the kernel
  has no ipv6 support

src/network_driver.c

index eaea454143e246854d7c66b18b4237d41c385721..84910ab2023d6b15c96c08f7ca42cdd501d45510 100644 (file)
@@ -801,6 +801,12 @@ static int networkDisableIPV6(virConnectPtr conn,
         goto cleanup;
     }
 
+    if (access(field, W_OK) < 0 && errno == ENOENT) {
+        VIR_DEBUG("ipv6 appears to already be disabled on %s", network->def->bridge);
+        ret = 0;
+        goto cleanup;
+    }
+
     if (virFileWriteStr(field, "1") < 0) {
         virReportSystemError(conn, errno,
                              _("cannot enable %s"), field);