[PATCH] network: restart dnsmasq after adding/removing txt and srv records

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Although dns host records are stored in a separate configuration file
that is reread by dnsmasq when it receives a SIGHUP, the txt and srv
records are directly in the dnsmasq .conf file which can't be reread
after initial dnsmasq startup. This means that if an srv or txt record
is modified in a network config, libvirt needs to restart the dnsmasq
process rather than just sending a SIGHUP.

This was pointed out in a question in
https://bugzilla.redhat.com/show_bug.cgi?id=988718 , but no separate
BZ was filed.
---
 src/network/bridge_driver.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 0fd2095..7c8d2cc 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3404,9 +3404,14 @@ networkUpdate(virNetworkPtr net,
         if (section == VIR_NETWORK_SECTION_BRIDGE ||
             section == VIR_NETWORK_SECTION_DOMAIN ||
             section == VIR_NETWORK_SECTION_IP ||
-            section == VIR_NETWORK_SECTION_IP_DHCP_RANGE) {
-            /* these sections all change things on the dnsmasq commandline,
-             * so we need to kill and restart dnsmasq.
+            section == VIR_NETWORK_SECTION_IP_DHCP_RANGE ||
+            section == VIR_NETWORK_SECTION_DNS_TXT ||
+            section == VIR_NETWORK_SECTION_DNS_SRV) {
+            /* these sections all change things on the dnsmasq
+             * commandline (i.e. in the .conf file), so we need to
+             * kill and restart dnsmasq, because dnsmasq sets its uid
+             * to "nobody" after it starts, and is unable to re-read
+             * the conf file (owned by root, mode 600)
              */
             if (networkRestartDhcpDaemon(driver, network) < 0)
                 goto cleanup;
@@ -3434,12 +3439,10 @@ networkUpdate(virNetworkPtr net,
                 goto cleanup;
             }
 
-        } else if (section == VIR_NETWORK_SECTION_DNS_HOST ||
-                   section == VIR_NETWORK_SECTION_DNS_TXT ||
-                   section == VIR_NETWORK_SECTION_DNS_SRV) {
-            /* these sections only change things in config files, so we
-             * can just update the config files and send SIGHUP to
-             * dnsmasq.
+        } else if (section == VIR_NETWORK_SECTION_DNS_HOST) {
+            /* this section only changes data in an external file
+             * (not the .conf file) so we can just update the config
+             * files and send SIGHUP to dnsmasq.
              */
             if (networkRefreshDhcpDaemon(driver, network) < 0)
                 goto cleanup;
-- 
2.5.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]