render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From 7a081e92617f2f05e9ef29d3eb65b557e7375815 Mon Sep 17 00:00:00 2001
Message-Id: <7a081e92617f2f05e9ef29d3eb65b557e7375815@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 6 Mar 2017 16:20:57 +0100
Subject: [PATCH] qemu: Allow empty script path to <interface/>

RHEL-7.4: https://bugzilla.redhat.com/show_bug.cgi?id=1412834
RHEL-7.3.z: https://bugzilla.redhat.com/show_bug.cgi?id=1429510

Before 9c17d665fdc5f (v1.3.2 - I know, right?) it was possible to
have the following interface configuration:

  <interface type='ethernet'/>
    <script path=''/>
  </interface>

This resulted in -netdev tap,script=,.. Fortunately, qemu helped
us to get away with this as it just ignored the empty script
path. However, after the commit mentioned above it's libvirtd
who is executing the script. Unfortunately without special
case-ing empty script path.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 1d9ab0f04af310e52f80b4281751655bb3bb7601)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/util/virnetdev.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index fa695d4a6..d12324878 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -2615,6 +2615,10 @@ virNetDevRunEthernetScript(const char *ifname, const char *script)
     virCommandPtr cmd;
     int ret;
 
+    /* Not a bug! Previously we did accept script="" as a NO-OP. */
+    if (STREQ(script, ""))
+        return 0;
+
     cmd = virCommandNew(script);
     virCommandAddArgFormat(cmd, "%s", ifname);
     virCommandClearCaps(cmd);
-- 
2.12.0