?

Log in

No account? Create an account

Solaris, IPV6, getnameinfo() completely busted?

« previous entry | next entry »
Jan. 4th, 2008 | 11:25 am

Dear LazyWeb,

No matter how I modify this following code it does not work with Solaris. Solaris always returns "non-recoverable name resolution failure":

     int error;
     char port_buf[NI_MAXSERV];
     size_socket addrLen = sizeof(vio->remote);
     if (getpeername(vio->sd, (struct sockaddr *) (&vio->remote),
                     &addrLen) != 0)
     {
       DBUG_PRINT("exit", ("getpeername gave error: %d", socket_errno));
       DBUG_RETURN(1);
     }

     if ((error= getnameinfo((struct sockaddr *)(&vio->remote),
                             sizeof(struct sockaddr_storage),
                             buf, buflen,
                             port_buf, NI_MAXSERV, NI_NUMERICHOST|NI_NUMERICSERV)))
     {
       WATCHPOINT_STRING(gai_strerror(error));
       DBUG_PRINT("exit", ("getnameinfo gave error: %s",
                           gai_strerror(error)));
       DBUG_RETURN(1);
     }




Linux, FreeBSD, OSX, AIX, Windows.... all are fine. Except Solaris. For DNS resolution nsswitch.conf lists files, then DNS.

I am completely capable of FUBAR code myself. So some part of me really does believe this is my mistake. When I google for "non-recoverable name resolution failure" and Solaris I get plenty of hits though, so I am skeptical.

Very few open source projects have good IPv6 support at this time, so it is not like I can just poke around and other groups code and see how they are doing it (though I am tempted to fire off some patches...).

(...and yes this is MySQL, and if I have to all platforms but Solaris get IPv6 support, I have a very low tolerance for work arounds on broken operating systems).

Link | Leave a comment |

Comments {18}

rainblogger

(no subject)

from: rainblogger
date: Jan. 5th, 2008 12:19 am (UTC)
Link

The current versions of Solaris are relatively complex when dealing with IPv4 and IPv6. Without knowing more than what you've posted, you should make sure that the following entries are in your nsswitch.conf file:

hosts: files dns # for IPv4
ipnodes: files dns # for IPv6

I have had a lot of problems related to the relationship of these files to name resolution system calls and it seems to be due to confusion on Sun's part. I have a cron job that keeps the content of these files synched to avoid behavioral differences for things like getent and ping vs. nslookup, resolver libs, etc.

Hope this helps.

Reply | Thread

rainblogger

(no subject)

from: rainblogger
date: Jan. 5th, 2008 12:22 am (UTC)
Link

Oh, and after changing nsswitch.conf, you'll want to do a

svcadm restart name-service-cache

to implement the changes.

Reply | Parent | Thread

Brian "Krow" Aker

(no subject)

from: krow
date: Jan. 5th, 2008 12:31 am (UTC)
Link

Both were set that way already :(

I keep looking to find some simple solution... thus far no luck.

Reply | Parent | Thread

rainblogger

(no subject)

from: rainblogger
date: Jan. 5th, 2008 12:37 am (UTC)
Link

Well, poop.

Reply | Parent | Thread

Brian "Krow" Aker

(no subject)

from: krow
date: Jan. 5th, 2008 12:52 am (UTC)
Link

No kidding... I would love to find out that I am wrong...

Reply | Parent | Thread