| 
28 | 28 | #ifdef HAVE_UNISTD_H  | 
29 | 29 | #include <unistd.h>  | 
30 | 30 | #endif  | 
31 |  | -#if HAVE_ARPA_INET_H  | 
32 |  | -#include <arpa/inet.h>  | 
33 |  | -#endif  | 
34 | 31 | #include <errno.h>  | 
35 | 32 | #include <string.h>  | 
36 | 33 | #include <sys/stat.h>  | 
 | 
41 | 38 | #include "opal/mca/mca.h"  | 
42 | 39 | #include "opal/mca/base/base.h"  | 
43 | 40 | #include "opal/util/if.h"  | 
 | 41 | +#include "opal/util/net.h"  | 
44 | 42 | #include "opal/mca/installdirs/installdirs.h"  | 
45 | 43 | 
 
  | 
46 | 44 | #include "orte/util/show_help.h"  | 
@@ -168,16 +166,11 @@ static int hostfile_parse_line(int token, opal_list_t* updates,  | 
168 | 166 |         }  | 
169 | 167 |         opal_argv_free (argv);  | 
170 | 168 | 
 
  | 
171 |  | -        // Strip off the FQDN if present  | 
172 |  | -        if( !orte_keep_fqdn_hostnames ) {  | 
 | 169 | +        // Strip off the FQDN if present, ignore IP addresses  | 
 | 170 | +        if( !orte_keep_fqdn_hostnames && !opal_net_isaddr(node_name) ) {  | 
173 | 171 |             char *ptr;  | 
174 |  | -            struct in_addr buf;  | 
175 |  | -            /* if the nodename is an IP address, do not mess with it! */  | 
176 |  | -            if (0 == inet_pton(AF_INET, node_name, &buf) &&  | 
177 |  | -                0 == inet_pton(AF_INET6, node_name, &buf)) {  | 
178 |  | -                if (NULL != (ptr = strchr(node_name, '.'))) {  | 
179 |  | -                    *ptr = '\0';  | 
180 |  | -                }  | 
 | 172 | +            if (NULL != (ptr = strchr(node_name, '.'))) {  | 
 | 173 | +                *ptr = '\0';  | 
181 | 174 |             }  | 
182 | 175 |         }  | 
183 | 176 | 
 
  | 
@@ -288,16 +281,11 @@ static int hostfile_parse_line(int token, opal_list_t* updates,  | 
288 | 281 |         }  | 
289 | 282 |         opal_argv_free (argv);  | 
290 | 283 | 
 
  | 
291 |  | -        // Strip off the FQDN if present  | 
292 |  | -        if( !orte_keep_fqdn_hostnames ) {  | 
 | 284 | +        // Strip off the FQDN if present, ignore IP addresses  | 
 | 285 | +        if( !orte_keep_fqdn_hostnames && !opal_net_isaddr(node_name) ) {  | 
293 | 286 |             char *ptr;  | 
294 |  | -            struct in_addr buf;  | 
295 |  | -            /* if the nodename is an IP address, do not mess with it! */  | 
296 |  | -            if (0 == inet_pton(AF_INET, node_name, &buf) &&  | 
297 |  | -                0 == inet_pton(AF_INET6, node_name, &buf)) {  | 
298 |  | -                if (NULL != (ptr = strchr(node_name, '.'))) {  | 
299 |  | -                    *ptr = '\0';  | 
300 |  | -                }  | 
 | 287 | +            if (NULL != (ptr = strchr(node_name, '.'))) {  | 
 | 288 | +                *ptr = '\0';  | 
301 | 289 |             }  | 
302 | 290 |         }  | 
303 | 291 | 
 
  | 
 | 
0 commit comments