[Dnsmasq-discuss] MX forwarding

Gene Czarcinski gene at czarc.net
Mon Aug 27 19:25:47 BST 2012


On 08/25/2012 04:23 PM, Gene Czarcinski wrote:
> On 08/25/2012 03:07 PM, Gene Czarcinski wrote:
>> On 08/24/2012 03:26 PM, Gene Czarcinski wrote:
>>> On 08/23/2012 10:26 AM, Gene Czarcinski wrote:
>>>> For a query from test2 of "host xxx", the response were:
>>>>
>>>> query[A]: config xxx.tst is NXDOMAIN-IPv6
>>>> query[A]: config xxx is NODATA-IPv4
>>>> query[AAAA]: config xxx is NODATA-IPv6
>>>> query[MX]: forwarded xxx to 192.168.122.1 <<------------
>> In the interest in moving this along, I took a look at the code. 
>> Unfortunately, I not quite sure where an actual fix should be done. I 
>> did a little "test" and added two lines to extract_request() in 
>> rfc1035.c .. I duplicated the T_ANY test and changed ANY to MX.
>>
>> The result was what I had hoped ... from the syslog:
>>   query[MX]: config xxx is NODATA-IPv4
>>
>> However, as I said in a previous message, I believe that no 
>> plain-names should be forwarded is "--domain-needed" is specified ... 
>> regardless of what "--local=" is.
>>
>
> OK, here is a little patch which seems to make thing work the way I 
> believe they should ... that does not make it right or the correct 
> thing to do. 
More refining the patch.  This is essentially the same as the previous 
patch except that I fixed up the comments.

Essentially but not really the same.  The significant difference is the 
flags is not set to "F_NXDOMAIN" rather then "F_NOERR".  As a result, 
the /usr/bin/host command is doing the right thing and gives a 
reasonable response to the user for a badhost query.

I believe that the patch changes the way dnsmasq response but I am not 
certain that this is the "right" thing to do ... even if it makes sense 
to me.

As usual, the patch is inline below as well as being attached.

Gene

---
diff -uNr dnsmasq-2.59.orig/src/forward.c dnsmasq-2.59/src/forward.c
--- dnsmasq-2.59.orig/src/forward.c    2011-10-07 10:09:30.000000000 -0400
+++ dnsmasq-2.59/src/forward.c    2012-08-27 14:11:06.581948635 -0400
@@ -207,10 +207,11 @@
        }
        }

-  if (flags == 0 && !(qtype & F_QUERY) &&
+  /* if domain-needed is specified, don't forward queries for
+    simple names (not just A or AAAA), except the empty name */
+  if (flags == 0 &&
        option_bool(OPT_NODOTS_LOCAL) && !strchr(qdomain, '.') && 
namelen != 0)
-    /* don't forward A or AAAA queries for simple names, except the 
empty name */
-    flags = F_NOERR;
+    flags = F_NXDOMAIN;

    if (flags == F_NXDOMAIN && check_for_local_domain(qdomain, now))
      flags = F_NOERR;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-domain-name-v2.patch
Type: text/x-patch
Size: 7289 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20120827/6294fb96/attachment.bin>


More information about the Dnsmasq-discuss mailing list