[rbldnsd] [patch] getnameinfo() fails on Solaris 9

Leandro Santi lesanti at uolsinectis.com.ar
Thu Jan 22 02:11:23 MSK 2004


On Thu, Jan 22, 2004, Michael Tokarev wrote:
> Leandro Santi wrote:
> >Hi,
> >
> >It seems that getnameinfo() fails on (at least) Solaris 9, but rbldnsd
> >doesn't test for failure.
> 
> The real question is: why it fails?

Because of (I think) library breakage - see bellow.

> ...
> Second, I don't understand why the test code ("autoconf"
> fragment) does what it does.
> 
> int main(void)
> {
>   char host[1024];
>   char serv[1024];
>   struct sockaddr_in sin;
>   memset(&sin, 0, sizeof(sin));
>   sin.sin_family = AF_INET;
>   sin.sin_port = htons(53);
>   if (getnameinfo((struct sockaddr*)&sin, sizeof(sin),
>                   host, sizeof(host), serv, sizeof(serv),
>                   NI_NUMERICHOST|NI_WITHSCOPEID|NI_NUMERICSERV))
>     return 1;
>   return 0;
> }
> 
> Why the hell may it fail?!  The only possible explanation I
> see is that same NI_WITHSCOPEID which may be unsupported on
> solaris...

Well, a system that fails to run successfully this test seems broken
to me. Solaris indeed fails, hence it deserves the BROKEN_GETNAMEINFO
label ;).

> And 3rd, when going this route, you forgot about the logging
> code as i mentioned above.  Note again that it just should not
> fail, period - what to log if we wasn't able to translate
> long integer into dotted-quad?  Commit suicide due to abnormal
> system environment? ;)

I understand your point - It doesn't make sense to log an abnormal
error status from a broken getnameinfo() implementation.

> Please try the code w/o NI_WITHSCOPEID.. if you don't know
> already what it does... ;)  It seems this should fix the
> problem.

Yep, but I thoght you really wanted to use NI_WITHSCOPEID, thats why
I built the test case. 

IOW, if you don't really care about NI_WITHSCOPEID, then it can be 
removed safely.

Leandro

ps: you may check

http://www.ietf.org/proceedings/99nov/I-D/draft-ietf-ipngwg-scopedaddr-format-00.txt

(deprecated draft) for an explanation of the NI_WITHSCOPEID flag.


More information about the rbldnsd mailing list