Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions orte/mca/rmaps/rank_file/rmaps_rank_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
#if HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#include <string.h>

#include "opal/util/argv.h"
#include "opal/util/if.h"
#include "opal/util/net.h"
#include "opal/class/opal_pointer_array.h"
#include "opal/mca/hwloc/base/base.h"

Expand Down Expand Up @@ -493,16 +491,11 @@ static int orte_rmaps_rank_file_parse(const char *rankfile)
}
opal_argv_free (argv);

// Strip off the FQDN if present
if( !orte_keep_fqdn_hostnames ) {
// Strip off the FQDN if present, ignore IP addresses
if( !orte_keep_fqdn_hostnames && !opal_net_isaddr(node_name) ) {
char *ptr;
struct in_addr buf;
/* if the nodename is an IP address, do not mess with it! */
if (0 == inet_pton(AF_INET, node_name, &buf) &&
0 == inet_pton(AF_INET6, node_name, &buf)) {
if (NULL != (ptr = strchr(node_name, '.'))) {
*ptr = '\0';
}
if (NULL != (ptr = strchr(node_name, '.'))) {
*ptr = '\0';
}
}

Expand Down
28 changes: 9 additions & 19 deletions orte/mca/rmaps/seq/rmaps_seq.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <ctype.h>

#include "opal/util/if.h"
#include "opal/util/net.h"
#include "opal/mca/hwloc/hwloc.h"

#include "orte/util/show_help.h"
Expand Down Expand Up @@ -191,17 +192,11 @@ static int orte_rmaps_seq_map(orte_job_t *jdata)
sq->cpuset = strdup(sep);
}

// Strip off the FQDN if present
if( !orte_keep_fqdn_hostnames ) {
// Strip off the FQDN if present, ignore IP addresses
if( !orte_keep_fqdn_hostnames && !opal_net_isaddr(hstname) ) {
char *ptr;
struct in_addr buf;

/* if the nodename is an IP address, do not mess with it! */
if (0 == inet_pton(AF_INET, hstname, &buf) &&
0 == inet_pton(AF_INET6, hstname, &buf)) {
if (NULL != (ptr = strchr(hstname, '.'))) {
*ptr = '\0';
}
if (NULL != (ptr = strchr(hstname, '.'))) {
*ptr = '\0';
}
}

Expand Down Expand Up @@ -301,16 +296,11 @@ static int orte_rmaps_seq_map(orte_job_t *jdata)
sq->cpuset = strdup(sep);
}

// Strip off the FQDN if present
if( !orte_keep_fqdn_hostnames ) {
// Strip off the FQDN if present, ignore IP addresses
if( !orte_keep_fqdn_hostnames && !opal_net_isaddr(hstname) ) {
char *ptr;
struct in_addr buf;
/* if the nodename is an IP address, do not mess with it! */
if (0 == inet_pton(AF_INET, hstname, &buf) &&
0 == inet_pton(AF_INET6, hstname, &buf)) {
if (NULL != (ptr = strchr(hstname, '.'))) {
(*ptr) = '\0';
}
if (NULL != (ptr = strchr(hstname, '.'))) {
(*ptr) = '\0';
}
}

Expand Down
17 changes: 5 additions & 12 deletions orte/util/dash_host/dash_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@
#include "orte_config.h"

#include <string.h>
#if HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif

#include "orte/constants.h"
#include "orte/types.h"

#include "orte/util/show_help.h"
#include "opal/util/argv.h"
#include "opal/util/if.h"
#include "opal/util/net.h"

#include "orte/mca/ras/base/base.h"
#include "orte/mca/plm/plm_types.h"
Expand Down Expand Up @@ -211,16 +209,11 @@ int orte_util_add_dash_host_nodes(opal_list_t *nodes,
ndname = mini_map[i];
}

// Strip off the FQDN if present
if( !orte_keep_fqdn_hostnames ) {
// Strip off the FQDN if present, ignore IP addresses
if( !orte_keep_fqdn_hostnames && !opal_net_isaddr(ndname) ) {
char *ptr;
struct in_addr buf;
/* if the nodename is an IP address, do not mess with it! */
if (0 == inet_pton(AF_INET, ndname, &buf) &&
0 == inet_pton(AF_INET6, ndname, &buf)) {
if (NULL != (ptr = strchr(ndname, '.'))) {
*ptr = '\0';
}
if (NULL != (ptr = strchr(ndname, '.'))) {
*ptr = '\0';
}
}

Expand Down
30 changes: 9 additions & 21 deletions orte/util/hostfile/hostfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
Expand All @@ -41,6 +38,7 @@
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/util/if.h"
#include "opal/util/net.h"
#include "opal/mca/installdirs/installdirs.h"

#include "orte/util/show_help.h"
Expand Down Expand Up @@ -168,16 +166,11 @@ static int hostfile_parse_line(int token, opal_list_t* updates,
}
opal_argv_free (argv);

// Strip off the FQDN if present
if( !orte_keep_fqdn_hostnames ) {
// Strip off the FQDN if present, ignore IP addresses
if( !orte_keep_fqdn_hostnames && !opal_net_isaddr(node_name) ) {
char *ptr;
struct in_addr buf;
/* if the nodename is an IP address, do not mess with it! */
if (0 == inet_pton(AF_INET, node_name, &buf) &&
0 == inet_pton(AF_INET6, node_name, &buf)) {
if (NULL != (ptr = strchr(node_name, '.'))) {
*ptr = '\0';
}
if (NULL != (ptr = strchr(node_name, '.'))) {
*ptr = '\0';
}
}

Expand Down Expand Up @@ -288,16 +281,11 @@ static int hostfile_parse_line(int token, opal_list_t* updates,
}
opal_argv_free (argv);

// Strip off the FQDN if present
if( !orte_keep_fqdn_hostnames ) {
// Strip off the FQDN if present, ignore IP addresses
if( !orte_keep_fqdn_hostnames && !opal_net_isaddr(node_name) ) {
char *ptr;
struct in_addr buf;
/* if the nodename is an IP address, do not mess with it! */
if (0 == inet_pton(AF_INET, node_name, &buf) &&
0 == inet_pton(AF_INET6, node_name, &buf)) {
if (NULL != (ptr = strchr(node_name, '.'))) {
*ptr = '\0';
}
if (NULL != (ptr = strchr(node_name, '.'))) {
*ptr = '\0';
}
}

Expand Down
20 changes: 7 additions & 13 deletions orte/util/proc_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Copyright (c) 2012 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand All @@ -32,9 +33,6 @@
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#include <ctype.h>

#include "opal/mca/base/base.h"
Expand Down Expand Up @@ -173,16 +171,12 @@ int orte_proc_info(void)
/* add this to our list of aliases */
opal_argv_append_nosize(&orte_process_info.aliases, hostname);

if (!orte_keep_fqdn_hostnames) {
/* if the nodename is an IP address, do not mess with it! */
if (0 == inet_pton(AF_INET, hostname, &buf) &&
0 == inet_pton(AF_INET6, hostname, &buf)) {
/* not an IP address, so remove any domain info */
if (NULL != (ptr = strchr(hostname, '.'))) {
*ptr = '\0';
/* add this to our list of aliases */
opal_argv_append_nosize(&orte_process_info.aliases, hostname);
}
// Strip off the FQDN if present, ignore IP addresses
if( !orte_keep_fqdn_hostnames && !opal_net_isaddr(hostname) ) {
if (NULL != (ptr = strchr(hostname, '.'))) {
*ptr = '\0';
/* add this to our list of aliases */
opal_argv_append_nosize(&orte_process_info.aliases, hostname);
}
}

Expand Down