From 53e1d56dd468e945ad311f46221a357dffda787b Mon Sep 17 00:00:00 2001
From: Stef Walter <stefw@gnome.org>
Date: Tue, 27 Mar 2012 16:20:54 +0200
Subject: [PATCH] Change the default of mdns_adv to false

 * Don't advertise information on the network without consent of
   the user, either through manual configuration, or a user
   interface that drives this option.
 * Since libvirtd must be configured for network access anyway
   (for all but ssh), this setting was not useful "out of the box",
   so changing this default setting does not remove "out of the box"
   functionality.
---
 AUTHORS                      | 1 +
 daemon/libvirtd.c            | 2 +-
 daemon/libvirtd.conf         | 4 ++--
 daemon/test_libvirtd.aug     | 8 ++++----
 docs/remote.html.in          | 2 +-
 tests/confdata/libvirtd.conf | 4 ++--
 tests/confdata/libvirtd.out  | 4 ++--
 7 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 64cf5491a4..881a8c1552 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -226,6 +226,7 @@ Patches have also been contributed by:
   Duncan Rance         <libvirt@dunquino.com>
   Peng Zhou            <ailvpeng25@gmail.com>
   Li Zhang             <zhlcindy@linux.vnet.ibm.com>
+  Stef Walter          <stefw@gnome.org>
 
   [....send patches to get your name here....]
 
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index c1ab32d521..44fb36395c 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -909,7 +909,7 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
 #endif
     data->auth_tls = REMOTE_AUTH_NONE;
 
-    data->mdns_adv = 1;
+    data->mdns_adv = 0;
 
     data->min_workers = 5;
     data->max_workers = 20;
diff --git a/daemon/libvirtd.conf b/daemon/libvirtd.conf
index 3eab2be487..50eda1b14d 100644
--- a/daemon/libvirtd.conf
+++ b/daemon/libvirtd.conf
@@ -56,8 +56,8 @@
 # Alternatively can disable for all services on a host by
 # stopping the Avahi daemon
 #
-# This is enabled by default, uncomment this to disable it
-#mdns_adv = 0
+# This is disabled by default, uncomment this to enable it
+#mdns_adv = 1
 
 # Override the default mDNS advertizement name. This must be
 # unique on the immediate broadcast network.
diff --git a/daemon/test_libvirtd.aug b/daemon/test_libvirtd.aug
index 58b7170e90..dbe532a14d 100644
--- a/daemon/test_libvirtd.aug
+++ b/daemon/test_libvirtd.aug
@@ -54,8 +54,8 @@ listen_addr = \"192.168.0.1\"
 # Alternatively can disable for all services on a host by
 # stopping the Avahi daemon
 #
-# This is enabled by default, uncomment this to disable it
-mdns_adv = 0
+# This is disabled by default, uncomment this to enable it
+mdns_adv = 1
 
 # Override the default mDNS advertizement name. This must be
 # unique on the immediate broadcast network.
@@ -330,8 +330,8 @@ audit_level = 2
         { "#comment" = "Alternatively can disable for all services on a host by" }
         { "#comment" = "stopping the Avahi daemon" }
         { "#comment" = "" }
-        { "#comment" = "This is enabled by default, uncomment this to disable it" }
-        { "mdns_adv" = "0" }
+        { "#comment" = "This is disabled by default, uncomment this to enable it" }
+        { "mdns_adv" = "1" }
         { "#empty" }
         { "#comment" = "Override the default mDNS advertizement name. This must be" }
         { "#comment" = "unique on the immediate broadcast network." }
diff --git a/docs/remote.html.in b/docs/remote.html.in
index 6a8e830236..e6af4c2205 100644
--- a/docs/remote.html.in
+++ b/docs/remote.html.in
@@ -738,7 +738,7 @@ Blank lines and comments beginning with <code>#</code> are ignored.
       </tr>
       <tr>
         <td> mdns_adv <i>[0|1]</i> </td>
-        <td> 1 (advertise with mDNS) </td>
+        <td> 0 (advertise with mDNS) </td>
         <td>
   If set to 1 then the virtualization service will be advertised over
   mDNS to hosts on the local LAN segment.
diff --git a/tests/confdata/libvirtd.conf b/tests/confdata/libvirtd.conf
index a943bfa195..2f2ba4b2f1 100644
--- a/tests/confdata/libvirtd.conf
+++ b/tests/confdata/libvirtd.conf
@@ -48,8 +48,8 @@ tcp_port = "16509"
 # Alternatively can disable for all services on a host by
 # stopping the Avahi daemon
 #
-# This is enabled by default, uncomment this to disable it
-mdns_adv = 0
+# This is disabled by default, uncomment this to enable it
+mdns_adv = 1
 
 # Override the default mDNS advertizement name. This must be
 # unique on the immediate broadcast network.
diff --git a/tests/confdata/libvirtd.out b/tests/confdata/libvirtd.out
index 0bebe2f1f5..171945da1a 100644
--- a/tests/confdata/libvirtd.out
+++ b/tests/confdata/libvirtd.out
@@ -37,8 +37,8 @@ tcp_port = "16509"
 # Alternatively can disable for all services on a host by
 # stopping the Avahi daemon
 #
-# This is enabled by default, uncomment this to disable it
-mdns_adv = 0
+# This is disabled by default, uncomment this to enable it
+mdns_adv = 1
 # Override the default mDNS advertizement name. This must be
 # unique on the immediate broadcast network.
 #