<p dir="ltr">There&#39;s a research project called Name Based Sockets where this have been done.</p>
<p dir="ltr">Take a look at: <a href="https://www.sics.se/projects/name-based-sockets">https://www.sics.se/projects/name-based-sockets</a></p>
<p dir="ltr">If you search for name based sockets on Google you will find a kernel module and user space code doing this.</p>
<div class="gmail_quote">On 8 Jul 2014 15:07, &quot;Kristof Provost&quot; &lt;<a href="mailto:kristof@sigsegv.be">kristof@sigsegv.be</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 2014-07-08 20:19:09 (+0800), shhuiw &lt;<a href="mailto:shhuiw@163.com">shhuiw@163.com</a>&gt; wrote:<br>
&gt; DNS loopkup should use UDP packet, and you have to construct UDP request<br>
&gt; based on your captured IP addresses in your module.<br>
DNS can actually use both TCP and UDP.<br>
<br>
&gt; And you have to use DNS server fallback lists and time-out control if some DNS<br>
&gt; server cannot work well.<br>
<br>
Yeah. Doing DNS lookups (forward or reverse) is complicated.<br>
There&#39;s a dns_query function in the kernel (net/dns_resolver), which<br>
apparently upcalls into user space, but I&#39;d avoid dealing with DNS in<br>
the kernel at all.<br>
<br>
Just pass the IP address to user space and let it deal with it. There<br>
are plenty of DNS libraries available. Odds are you need to pass the<br>
resulting information to user space anyway, so you&#39;re not really losing<br>
anything.<br>
<br>
What are you trying to accomplish anyway?<br>
<br>
Regards,<br>
Kristof<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div>