<div dir="ltr"><div>Date: Monday 11th February 2013 09:45:46 UTC (over 4 years ago)</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mon, Feb 11, 2013 at 09:11:47AM +0000, Simon Kelley wrote:<br>> On 11/02/13 09:02, trang dang wrote:<br>><br>> > Hello,<br>> ><br>> > I use dnsmasq 2.63 on debian, only dns is on, and want to read cache<br>> > dump with a small script. Till now the cache dump has been written<br>> > in extra log file (log-facility is on) or in syslog. Is there any<br>> > way to get an extra cache file? It will be easier to parse the<br>> > content of the cache. Furthermore, the host name in the log is cut<br>> > after about 39 characters. Is there any way to get the complete<br>> > content?<br>><br>> There's not way to do either of those, sorry. You best bet is probably<br>> to start hacking on the existing cache dumping code in src/cache.c to<br>> make it do what you want.<br>I did exactly this about a month ago:¹<br><a href="https://github.com/guns/dnsmasq/commit/13ac5ace736a5d24c629d8cadc65eda92ea443cb.patch">https://github.com/guns/dnsmasq/commit/13ac5ace736a5d24c629d8cadc65eda92ea443cb.patch</a><br>This adds a `--hosts-cache=` option that dumps the current cache<br>to  in hosts file format on SIGUSR1.<br>If anyone is curious why I would want such a feature, I am using the<br>information to construct firewalls for children (e.g. visit <a href="http://pbs.org">pbs.org</a>,<br>browse around, dump hosts to file, then add them to child's outbound<br>firewall rules). There are other ways to go about this, but I found this<br>to be straightforward.<br>It also happens to be useful for navigating to sites whose DNS entries<br>have been recently hijacked, which has become a frightening reality in<br>recent years.<br>    guns</blockquote><div><br></div><div>This is exactly what I am looking for. </div><div><br></div><div>@Simon, </div><div><br></div><div>The dnsmasq cache dump is a feature that is desirable by many people, and this is the most straightforward solution. Would you take this patch please, or there are better ways to do it now? </div><div><br></div><div>Thanks</div><div><br></div><div><br></div><div><br></div></div>