Skip to content

Commit 276de13

Browse files
committed
Make interface's kernel index an int instead of int16_t
Sometimes, the ethernet interfaces can get quite high kernel indices. struct ifreq (see netdevice(7)) defines ifr_ifindex to be int's. The OOB component used int16_t internally for matching (in case of -mca oob_tcp_if_[in|ex]clude) which meant that any interface index > 32767 would never be matched because the integer would be truncated to int16_t upon return from the function. OOB would then refuse to work because it didn't find any usable interfaces and MPI job would abort. Signed-off-by: Wojtek Wasko <wwasko@nvidia.com>
1 parent 97d0469 commit 276de13

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

opal/util/if.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ int opal_ifnametoindex(const char* if_name)
133133
* corresponding kernel index.
134134
*/
135135

136-
int16_t opal_ifnametokindex(const char* if_name)
136+
int opal_ifnametokindex(const char* if_name)
137137
{
138138
opal_if_t* intf;
139139

@@ -235,7 +235,7 @@ int opal_ifaddrtoname(const char* if_addr, char* if_name, int length)
235235
* or hostname) and return the kernel index of the interface
236236
* on the same network as the specified address
237237
*/
238-
int16_t opal_ifaddrtokindex(const char* if_addr)
238+
int opal_ifaddrtokindex(const char* if_addr)
239239
{
240240
opal_if_t* intf;
241241
int error;
@@ -729,7 +729,7 @@ opal_ifnametoindex(const char* if_name)
729729
return OPAL_ERR_NOT_SUPPORTED;
730730
}
731731

732-
int16_t
732+
int
733733
opal_ifnametokindex(const char* if_name)
734734
{
735735
return OPAL_ERR_NOT_SUPPORTED;

opal/util/if.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ OPAL_DECLSPEC int opal_ifnametoindex(const char* if_name);
8888
* @param if_name (IN) Interface name
8989
* @return Interface kernel index
9090
*/
91-
OPAL_DECLSPEC int16_t opal_ifnametokindex(const char* if_name);
91+
OPAL_DECLSPEC int opal_ifnametokindex(const char* if_name);
9292

9393
/*
9494
* Attempt to resolve an address (given as either IPv4/IPv6 string
9595
* or hostname) and return the kernel index of the interface
9696
* that is on the same network as the specified address
9797
*/
98-
OPAL_DECLSPEC int16_t opal_ifaddrtokindex(const char* if_addr);
98+
OPAL_DECLSPEC int opal_ifaddrtokindex(const char* if_addr);
9999

100100
/**
101101
* Lookup an interface by opal_list index and return its kernel index.

0 commit comments

Comments
 (0)