File c1deb7f5-ifname_guest_actual_fix.patch of Package libvirt.11695

From c1deb7f58ced1d1d1888aec2632d78bb2cd99eb1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Fri, 19 Dec 2014 10:08:38 +0100
Subject: [PATCH] lxc: Move setting ifname_guest_actual to
 virLXCSetupInterfaces

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 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: libvirt-1.2.5/src/lxc/lxc_process.c
===================================================================
--- libvirt-1.2.5.orig/src/lxc/lxc_process.c
+++ libvirt-1.2.5/src/lxc/lxc_process.c
@@ -259,8 +259,6 @@ char *virLXCProcessSetupInterfaceBridged
 
     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,
@@ -455,6 +453,9 @@ static int virLXCProcessSetupInterfaces(
 
         (*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 (!def->nets[i]->ifname_guest) {
             if (virAsprintf(&def->nets[i]->ifname_guest, "eth%zu", niface) < 0)
openSUSE Build Service is sponsored by