[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4A6422E8.9000001@gmail.com>
Date: Mon, 20 Jul 2009 09:55:20 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Rémi Denis-Courmont
<remi.denis-courmont@...ia.com>
CC: ext Zsolt SZALAI <zs.szalai@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: getaddrinfo - too many recvmsg calls
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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists