<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Thank you for your responses sirs and the advice. My target is to,<br><br>1. Intercept SYN packet<br>2. Obtain the destination IP address<br>3. Resolve the TLD of that IP<br>4. then bind each packet to queues depending on the TLD<br><br>I will check on nslookup, open DNS client utilities and dns_resolver libraries as you experts suggested :)<br><br>Best Regards,<br>H. Hasitha Shan<br><br><br><br><div><hr id="stopSpelling">Date: Tue, 8 Jul 2014 15:20:16 +0200<br>Subject: Re: Re: Linux Kernel Module program to obtain domain name from IP<br>From: kristofer.hallin@gmail.com<br>To: kristof@sigsegv.be<br>CC: kernelnewbies@kernelnewbies.org; shhuiw@163.com; sudipm.mukherjee@gmail.com; hh_shan@live.com<br><br><p dir="ltr">There'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" target="_blank">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="ecxgmail_quote">On 8 Jul 2014 15:07, "Kristof Provost" <<a href="mailto:kristof@sigsegv.be">kristof@sigsegv.be</a>> wrote:<br><blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex;">
On 2014-07-08 20:19:09 (+0800), shhuiw <<a href="mailto:shhuiw@163.com">shhuiw@163.com</a>> wrote:<br>
> DNS loopkup should use UDP packet, and you have to construct UDP request<br>
> based on your captured IP addresses in your module.<br>
DNS can actually use both TCP and UDP.<br>
<br>
> And you have to use DNS server fallback lists and time-out control if some DNS<br>
> server cannot work well.<br>
<br>
Yeah. Doing DNS lookups (forward or reverse) is complicated.<br>
There's a dns_query function in the kernel (net/dns_resolver), which<br>
apparently upcalls into user space, but I'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'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></div>                                            </div></body>
</html>