Page 1 of 1

Re: [Nagios-devel] netutils use of socket descriptor

Posted: Sun Jun 21, 2009 3:32 pm
by Guest
* Thomas Guyot-Sionnest [2009-06-17 16:18]:
> While the above patch doesn't change any behavior, I was wondering if it
> could loop in case we get a mix of IPv4/v6 addresses and one of the two
> isn't supported. It looks like it would return EINVAL (Unknown protocol,
> or protocol family not available.) in that case, but I'm not experienced
> at all in sockets...

The getaddrinfo(3) call will currently provide IPv4 addresses only, as
hints.ai_family is set to PF_INET. Of course, it would be nice if this
could be changed in order to support IPv6, too. But even then, I don't
see a reason to handle EINVAL (or EPROTONOSUPPORT) specially. Simply
loop over all available addresses and use the first one that works,
regardless of why any others don't work.

Holger





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]