]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
lxc: Move setting ifname_guest_actual to virLXCSetupInterfaces
authorGuido Günther <agx@sigxcpu.org>
Fri, 19 Dec 2014 09:08:38 +0000 (10:08 +0100)
committerGuido Günther <agx@sigxcpu.org>
Mon, 12 Jan 2015 17:01:46 +0000 (18:01 +0100)
so it applies to interfaces of type 'direct' too.

Reported and patch provided by Bastian Blank at

    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=769600

src/lxc/lxc_process.c

index d7eb8bc86fa21bcae9c353afc5763b3e92e21b80..af08de9cdce4a79bfe9f5835c312ab5fc0875a36 100644 (file)
@@ -260,8 +260,6 @@ char *virLXCProcessSetupInterfaceBridged(virConnectPtr conn,
 
     if (virNetDevSetMAC(containerVeth, &net->mac) < 0)
         goto cleanup;
-    if (VIR_STRDUP(net->ifname_guest_actual, containerVeth) < 0)
-        goto cleanup;
 
     if (vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) {
         if (virNetDevOpenvswitchAddPort(brname, parentVeth, &net->mac,
@@ -432,6 +430,9 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn,
 
         (*veths)[(*nveths)-1] = veth;
 
+        if (VIR_STRDUP(def->nets[i]->ifname_guest_actual, veth) < 0)
+            goto cleanup;
+
         /* Make sure all net definitions will have a name in the container */
         if (!net->ifname_guest) {
             if (virAsprintf(&net->ifname_guest, "eth%zu", niface) < 0)