[Libvir] PATCH: Use --strict-order with dnsmasq

Daniel P. Berrange berrange at redhat.com
Tue May 1 12:24:35 UTC 2007


A bug reported by David Lutterkort...

The 'man resolv.conf' docs for 'nameserver' say

[quote]
       nameserver Name server IP address
              Internet  address  (in  dot  notation)  of a name server that the
              resolver should query.  Up to MAXNS (currently 3, see <resolv.h>)
              name servers may be listed, one per keyword.  If there are multi-
              ple servers, the resolver  library  queries  them  in  the  order
              listed.   If no nameserver entries are present, the default is to
              use the name server on the local machine.  (The algorithm used is
              to  try  a name server, and if the query times out, try the next,
              until out of name  servers,  then  repeat  trying  all  the  name
              servers until a maximum number of retries are made.)
[/quote]

While 'man dnsmasq' docs for 'strict-order' say:

[quote]
       -o, --strict-order
              By  default,  dnsmasq  will  send  queries to any of the upstream
              servers it knows about and tries to favour servers to  are  known
              to be up. Setting this flag forces dnsmasq to try each query with
              each server strictly in the order they appear in /etc/resolv.conf
[/quote]

So by default, the algorithm dnsmasq uses for DNS lookups is 

 a) Different from that use by GLibC
 b) Wrong

Thus I think we should always use --strict-order when running dnsmasq. The
attached patch adds this

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
-------------- next part --------------
Index: qemud/qemud.c
===================================================================
RCS file: /data/cvs/libvirt/qemud/qemud.c,v
retrieving revision 1.39
diff -u -p -r1.39 qemud.c
--- qemud/qemud.c	10 Apr 2007 23:17:46 -0000	1.39
+++ qemud/qemud.c	1 May 2007 12:10:43 -0000
@@ -1110,6 +1110,7 @@ qemudBuildDnsmasqArgv(struct qemud_serve
     len =
         1 + /* dnsmasq */
         1 + /* --keep-in-foreground */
+        1 + /* --strict-order */
         1 + /* --bind-interfaces */
         2 + /* --pid-file "" */
         2 + /* --conf-file "" */
@@ -1133,6 +1134,11 @@ qemudBuildDnsmasqArgv(struct qemud_serve
     APPEND_ARG(*argv, i++, "dnsmasq");
 
     APPEND_ARG(*argv, i++, "--keep-in-foreground");
+    /*
+     * Needed to ensure dnsmasq uses same algorithm for processing
+     * multiple nameserver entries in /etc/resolv.conf as GLibC.
+     */
+    APPEND_ARG(*argv, i++, "--strict-order");
     APPEND_ARG(*argv, i++, "--bind-interfaces");
 
     APPEND_ARG(*argv, i++, "--pid-file");


More information about the libvir-list mailing list