d20fcae
diff --git a/plugins/ipmidirect/ipmi.cpp b/plugins/ipmidirect/ipmi.cpp
d20fcae
index f6745cf6..3b4918de 100644
d20fcae
--- a/plugins/ipmidirect/ipmi.cpp
d20fcae
+++ b/plugins/ipmidirect/ipmi.cpp
d20fcae
@@ -1929,7 +1929,12 @@ cIpmi::AllocConnection( GHashTable *handler_config )
d20fcae
        char            user[32]   = "";
d20fcae
        char            passwd[32] = "";
d20fcae
        char           *value;
d20fcae
-       struct hostent *ent;
d20fcae
+       struct addrinfo hints, *servinfo = NULL;
d20fcae
+       char portnumber_string[4];
d20fcae
+
d20fcae
+       memset(&hints, 0, sizeof(hints));
d20fcae
+       hints.ai_family = AF_UNSPEC;
d20fcae
+       hints.ai_socktype = SOCK_STREAM;
d20fcae
 
d20fcae
        // Address
d20fcae
        addr = (const char *)g_hash_table_lookup(handler_config, "addr");
d20fcae
@@ -1941,16 +1946,16 @@ cIpmi::AllocConnection( GHashTable *handler_config )
d20fcae
           }
d20fcae
 
d20fcae
        stdlog << "AllocConnection: addr = '" << addr << "'.\n";
d20fcae
-       ent = gethostbyname( addr );
d20fcae
+       (void)sprintf(portnumber_string, "%d", lan_port);
d20fcae
 
d20fcae
-       if ( !ent )
d20fcae
+       if (getaddrinfo(addr, portnumber_string, &hints, &servinfo) != 0) 
d20fcae
           {
d20fcae
             stdlog << "Unable to resolve IPMI LAN address: " << addr << " !\n";
d20fcae
             return 0;
d20fcae
           }
d20fcae
 
d20fcae
-       memcpy( &lan_addr, ent->h_addr_list[0], ent->h_length );
d20fcae
-       unsigned int a = *(unsigned int *)(void *)ent->h_addr_list[0];
d20fcae
+       memcpy(&lan_addr, servinfo->ai_addr, servinfo->ai_addrlen);
d20fcae
+       unsigned int a = *(unsigned int *)(void *)servinfo->ai_addr;
d20fcae
 
d20fcae
        stdlog << "Using host at "
d20fcae
               << (int)(a & 0xff) << "."
d20fcae
@@ -1958,6 +1963,8 @@ cIpmi::AllocConnection( GHashTable *handler_config )
d20fcae
               << (int)((a >> 16) & 0xff) << "."
d20fcae
               << (int)((a >> 24) & 0xff) << ".\n";
d20fcae
 
d20fcae
+       freeaddrinfo(servinfo);
d20fcae
+
d20fcae
        // Port
d20fcae
        lan_port = GetIntNotNull( handler_config, "port", 623 );
d20fcae