]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
remote: fix systemd IP socket activation with virtproxyd
authorDaniel P. Berrangé <berrange@redhat.com>
Fri, 20 Sep 2019 15:18:41 +0000 (16:18 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Mon, 30 Sep 2019 11:04:29 +0000 (12:04 +0100)
We recently forbid the use of --listen with socket activation:

  commit 3a6a725b8f575890ee6c151ad1f46ea0ceea1f3b
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Thu Aug 22 14:52:16 2019 +0100

      remote: forbid the --listen arg when systemd socket activation

In this change we forgot that virtproxyd doesn't have a --listen
parameter, and instead behaves as if it was always present. Thus
when systemd socket activation is present, we must disable this
built-in default

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/remote/remote_daemon.c

index 7195ac9218406610445db5da4c614cf3c81eaeea..9281e226c4aac2d6b962c5f1ca0d2ee0896b0cae 100644 (file)
@@ -423,11 +423,32 @@ daemonSetupNetworking(virNetServerPtr srv,
         return -1;
 
 #ifdef WITH_IP
+# ifdef LIBVIRTD
     if (act && ipsock) {
         VIR_ERROR(_("--listen parameter not permitted with systemd activation "
                     "sockets, see 'man libvirtd' for further guidance"));
         return -1;
     }
+# else /* ! LIBVIRTD */
+    /*
+     * "ipsock" traditionally reflected whether --listen is set.
+     * The listen_tcp & listen_tls params in libvirtd.conf were
+     * not honoured unless --listen was set.
+     *
+     * In virtproxyd we dropped --listen, and have listen_tcp and
+     * listen_tls in the config file both default to 0. The user
+     * can turn on listening simply by setting the libvirtd.conf
+     * file settings and doesn't have to worry about also adding
+     * --listen, which is saner.
+     *
+     * Hence, we initialized ipsock == 1 by default with virtproxyd.
+     * When using systemd activation though, we clear ipsock, so
+     * later code doesn't have any surprising behaviour differences
+     * for virtproxyd vs libvirtd.
+     */
+    if (act)
+        ipsock = 0;
+# endif /* ! LIBVIRTD */
 #endif /* ! WITH_IP */
 
     if (config->unix_sock_group) {