netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: "Rémi Denis-Courmont" <remi.denis-courmont@nokia.com>
Cc: ext Zsolt SZALAI <zs.szalai@gmail.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: getaddrinfo - too many recvmsg calls
Date: Mon, 20 Jul 2009 09:55:20 +0200	[thread overview]
Message-ID: <4A6422E8.9000001@gmail.com> (raw)
In-Reply-To: <200907201014.18063.remi.denis-courmont@nokia.com>

Rémi Denis-Courmont a écrit :
> On Monday 20 July 2009 10:05:56 ext Zsolt SZALAI wrote:
>> The sanitycheck is now really simple, just a
>>     addrinfo hints = { 0, AF_INET, 0, 0, 0, NULL, NULL, NULL };
>>     int result = getaddrinfo(ipAddress, NULL, &hints, &addresses);
>> call.
> 
> What the heck is this supposed to do?
> This piece of code tries to resolve <ipAddress> as numerical IPv4 address *or* 
> a DNS hostname.
> 
> If you want to check that a string is a valid IP address, call inet_pton(). If 
> you want to check that an IP address is assigned to the system, create a 
> socket and bind to that address.
> 

Yes, but beware of ip_nonlocal_bind option (/proc/sys/net/ipv4/ip_nonlocal_bind).

If set to one, bind() will not tell you if address is assigned to the system.

      reply	other threads:[~2009-07-20  7:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-20  7:05 getaddrinfo - too many recvmsg calls Zsolt SZALAI
2009-07-20  7:14 ` Rémi Denis-Courmont
2009-07-20  7:55   ` Eric Dumazet [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A6422E8.9000001@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=remi.denis-courmont@nokia.com \
    --cc=zs.szalai@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).