Blame SOURCES/libvirt-virNetDevMacVLanCreateWithVPortProfile-Don-t-mask-virNetDevMacVLanTapOpen-error.patch

6ae9ed
From c89a04073228b917f1b9a2804267dcabce16f231 Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <c89a04073228b917f1b9a2804267dcabce16f231@dist-git>
6ae9ed
From: Michal Privoznik <mprivozn@redhat.com>
6ae9ed
Date: Wed, 10 Aug 2016 17:05:26 +0200
6ae9ed
Subject: [PATCH] virNetDevMacVLanCreateWithVPortProfile: Don't mask
6ae9ed
 virNetDevMacVLanTapOpen error
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1240439
6ae9ed
6ae9ed
In this function we create a macvtap device and open its tap
6ae9ed
device. Possibly multiple times. Now the thing is, if opening the
6ae9ed
tap device fails, that is virNetDevMacVLanTapOpen() returns a
6ae9ed
negative value, we unroll all the changes BUT return 0 fooling
6ae9ed
caller into thinking everything went okay.
6ae9ed
6ae9ed
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6ae9ed
(cherry picked from commit 96e24861564dfdc21b843f00d094d71e696366bd)
6ae9ed
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6ae9ed
---
6ae9ed
 src/util/virnetdevmacvlan.c | 4 +++-
6ae9ed
 1 file changed, 3 insertions(+), 1 deletion(-)
6ae9ed
6ae9ed
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
6ae9ed
index c05c67f..88a0f94 100644
6ae9ed
--- a/src/util/virnetdevmacvlan.c
6ae9ed
+++ b/src/util/virnetdevmacvlan.c
6ae9ed
@@ -1120,8 +1120,10 @@ virNetDevMacVLanCreateWithVPortProfile(const char *ifnameRequested,
6ae9ed
     }
6ae9ed
 
6ae9ed
     if (flags & VIR_NETDEV_MACVLAN_CREATE_WITH_TAP) {
6ae9ed
-        if (virNetDevMacVLanTapOpen(ifnameCreated, tapfd, tapfdSize, 10) < 0)
6ae9ed
+        if (virNetDevMacVLanTapOpen(ifnameCreated, tapfd, tapfdSize, 10) < 0) {
6ae9ed
+            rc = -1;
6ae9ed
             goto disassociate_exit;
6ae9ed
+        }
6ae9ed
 
6ae9ed
         if (virNetDevMacVLanTapSetup(tapfd, tapfdSize, vnet_hdr) < 0) {
6ae9ed
             VIR_FORCE_CLOSE(rc); /* sets rc to -1 */
6ae9ed
-- 
6ae9ed
2.9.2
6ae9ed