5c27b6
From 7a081e92617f2f05e9ef29d3eb65b557e7375815 Mon Sep 17 00:00:00 2001
5c27b6
Message-Id: <7a081e92617f2f05e9ef29d3eb65b557e7375815@dist-git>
5c27b6
From: Michal Privoznik <mprivozn@redhat.com>
5c27b6
Date: Mon, 6 Mar 2017 16:20:57 +0100
5c27b6
Subject: [PATCH] qemu: Allow empty script path to <interface/>
5c27b6
5c27b6
RHEL-7.4: https://bugzilla.redhat.com/show_bug.cgi?id=1412834
5c27b6
RHEL-7.3.z: https://bugzilla.redhat.com/show_bug.cgi?id=1429510
5c27b6
5c27b6
Before 9c17d665fdc5f (v1.3.2 - I know, right?) it was possible to
5c27b6
have the following interface configuration:
5c27b6
5c27b6
  <interface type='ethernet'/>
5c27b6
    <script path=''/>
5c27b6
  </interface>
5c27b6
5c27b6
This resulted in -netdev tap,script=,.. Fortunately, qemu helped
5c27b6
us to get away with this as it just ignored the empty script
5c27b6
path. However, after the commit mentioned above it's libvirtd
5c27b6
who is executing the script. Unfortunately without special
5c27b6
case-ing empty script path.
5c27b6
5c27b6
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
5c27b6
(cherry picked from commit 1d9ab0f04af310e52f80b4281751655bb3bb7601)
5c27b6
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
5c27b6
---
5c27b6
 src/util/virnetdev.c | 4 ++++
5c27b6
 1 file changed, 4 insertions(+)
5c27b6
5c27b6
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
5c27b6
index fa695d4a6..d12324878 100644
5c27b6
--- a/src/util/virnetdev.c
5c27b6
+++ b/src/util/virnetdev.c
5c27b6
@@ -2615,6 +2615,10 @@ virNetDevRunEthernetScript(const char *ifname, const char *script)
5c27b6
     virCommandPtr cmd;
5c27b6
     int ret;
5c27b6
 
5c27b6
+    /* Not a bug! Previously we did accept script="" as a NO-OP. */
5c27b6
+    if (STREQ(script, ""))
5c27b6
+        return 0;
5c27b6
+
5c27b6
     cmd = virCommandNew(script);
5c27b6
     virCommandAddArgFormat(cmd, "%s", ifname);
5c27b6
     virCommandClearCaps(cmd);
5c27b6
-- 
5c27b6
2.12.0
5c27b6