<div dir="ltr">Thanks Simon. <div><br></div><div style>I think all I need is the <span style="font-family:arial,sans-serif;font-size:13px"><b>simple case - append</b>, As as you say then the reverse operation is easy to do, so a simple version would be possible.</span></div>

<div style><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div style><span style="font-family:arial,sans-serif;font-size:13px">Append on the way out, trim off on the way back. </span></div><div style>

<span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div style><span style="font-family:arial,sans-serif;font-size:13px">Is forward.c the right place to be looking?</span></div><div style><span style="font-family:arial,sans-serif;font-size:13px"><br>

</span></div><div style><span style="font-family:arial,sans-serif;font-size:13px">Thanks</span></div><div style><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div style><span style="font-family:arial,sans-serif;font-size:13px"><br>

</span></div><div style><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div></div><div class="gmail_extra"><br clear="all"><div>Stu</div>
<br><br><div class="gmail_quote">On Sat, May 4, 2013 at 8:40 PM, Simon Kelley <span dir="ltr"><<a href="mailto:simon@thekelleys.org.uk" target="_blank">simon@thekelleys.org.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im">On 04/05/13 18:27, Stuart Jenkins wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
First off I can see the “potential for abuse” in my question. Its<br>
actually not the desire to do abuse which is causing the question –<br>
quite the reverse – it’s the ability to rewrite domain requests so I can<br>
hit a white list and hence filter traffic going through my access point.<br>
<br>
Personally I come from a .NET background and I have a client and server<br>
solution already working in .NET; But I want one working on an Access<br>
point. Hence getting an old TP-Link Access point, flashing with Openwrt<br>
(which nicely comes with DNSMASQ) and almost everything is ready to rock<br>
bar one thing.<br>
<br>
I want when a DNS request hits DNSMASQ (which will forward all requests<br>
to my own DNS Servers) for it to be able to alter the request.<br>
Specifically if the request was for <a href="http://www.domain.com" target="_blank">www.domain.com</a><br></div>
<<a href="http://www.domain.com/" target="_blank">http://www.domain.com/</a>> I want it to become<br>
<a href="http://www.domain.com.AccessPointID.FilterDomain.com" target="_blank">www.domain.com.AccessPointID.<u></u>FilterDomain.com</a><br>
<<a href="http://www.domain.com.accesspointid.filterdomain.com/" target="_blank">http://www.domain.com.<u></u>accesspointid.filterdomain.<u></u>com/</a>> (ideally<br>
<a href="http://AccessPointID.FilterDomain.com" target="_blank">AccessPointID.FilterDomain.com</a> <<a href="http://AccessPointID.FilterDomain.com" target="_blank">http://AccessPointID.<u></u>FilterDomain.com</a>><div class="im">

<br>
being specified in the config for dnsmasq as an “always append”)<br>
<br>
Where FilterDomain.com I control the Nameserver for – hence I get all<br>
the requests.<br>
<br>
The AccessPoint ID part of the request tells me which accesspoint it is<br>
and hence I know whether to filter <a href="http://www.domain.com" target="_blank">www.domain.com</a><br></div>
<<a href="http://www.domain.com" target="_blank">http://www.domain.com</a>> or not for that access point.<div class="im"><br>
<br>
  Having looked through the man page, and all the options, even to the<br>
point of downloading the source of dnsmasq and looking at forward.c; I<br>
don’t believe out of the box I can do what I want with dnsmasq; and the<br>
C…. hmmm its not my strong suit.<br>
<br>
So finally the questions:<br>
<br></div>
1.Am I right? Dnsmasq cannot do what I desire out of the box as it<div class="im"><br>
doesn’t have the desired feature (probably by design)<br>
<br>
</div></blockquote>
Correct.<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2.Am I right in that it “could” be programmed into forward.c<br>
</blockquote>
<br>
Doing this is rather more difficult than you might imagine. The reason is the way dnsmasq forwards DNS queries. Essentially, it forwards the query complete, and keeps very little information about the query - just enough to route the answer when it arrives. Re-writing the query on the way out is easy, but there isn't enough information saved to restore it on the way back. The original requestor is expecting an answer to its original query, not something different.<br>


<br>
Of course for the simple case - append, then the reverse operation is easy to do, so a simple version would be possible.<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
3.And if so any hints where to look in forward.c as I …. Well I struggled.<br>
<br>
</blockquote>
<br>
Not trivial, because the query is passed through in wire format. To be able to modify it, you'll have to add a lot of extra code.<br>
<br>
<br>
Not a particularly helpful answer, sorry.<br>
<br>
Cheers,<br>
<br>
Simon.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks in advance<br>
<br>
<br>
Stu<br>
<br>
<br>
______________________________<u></u>_________________<br>
Dnsmasq-discuss mailing list<br>
<a href="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk" target="_blank">Dnsmasq-discuss@lists.<u></u>thekelleys.org.uk</a><br>
<a href="http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss" target="_blank">http://lists.thekelleys.org.<u></u>uk/mailman/listinfo/dnsmasq-<u></u>discuss</a><br>
<br>
</blockquote>
<br>
<br>
______________________________<u></u>_________________<br>
Dnsmasq-discuss mailing list<br>
<a href="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk" target="_blank">Dnsmasq-discuss@lists.<u></u>thekelleys.org.uk</a><br>
<a href="http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss" target="_blank">http://lists.thekelleys.org.<u></u>uk/mailman/listinfo/dnsmasq-<u></u>discuss</a><br>
</blockquote></div><br></div>