[libvirt] [PATCH] qemu: Allow empty script path to <interface/>

Michal Privoznik mprivozn at redhat.com
Thu Feb 2 13:49:48 UTC 2017

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

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

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 at redhat.com>
 docs/news.xml        | 10 ++++++++++
 src/util/virnetdev.c |  4 ++++
 2 files changed, 14 insertions(+)

diff --git a/docs/news.xml b/docs/news.xml
index f408293a1..e7388a8f6 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -56,6 +56,16 @@
           a fabric name has been removed by making it optional.
+      <change>
+        <summary>
+          qemu: Allow empty script path to <interface/>
+        </summary>
+        <description>
+          Historically, this was always allowed. Unfortunately, due to some
+          rework done for 1.3.2 release a bug was dragged in which suddenly
+          stop allowing domain with such configuration to start.
+        </description>
+      </change>
   <release version="v3.0.0" date="2017-01-17">
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);

More information about the libvir-list mailing list