Fix compiler errors on Solaris, NetBSD, and OpenBSD:
* Per http://www.open-mpi.org/community/lists/devel/2013/12/13504.php, protect usage of struct ifreq->ifr_hwaddr * Per http://www.open-mpi.org/community/lists/devel/2013/12/13503.php, avoid #define conflict with the token "if_mtu" * Also fix some whitespace and string naming issues in opal/util/if.c Tested by Paul Hargrove. Refs trac:4010 This commit was SVN r30006. The following Trac tickets were found above: Ticket 4010 --> https://svn.open-mpi.org/trac/ompi/ticket/4010
Этот коммит содержится в:
родитель
d78a9cdd77
Коммит
090ce4187a
@ -86,5 +86,5 @@ static void opal_if_construct(opal_if_t *obj)
|
|||||||
obj->if_mask = 0;
|
obj->if_mask = 0;
|
||||||
obj->if_bandwidth = 0;
|
obj->if_bandwidth = 0;
|
||||||
memset(obj->if_mac, 0, sizeof(obj->if_mac));
|
memset(obj->if_mac, 0, sizeof(obj->if_mac));
|
||||||
obj->if_mtu = 0;
|
obj->ifmtu = 0;
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,8 @@ typedef struct opal_if_t {
|
|||||||
uint32_t if_mask;
|
uint32_t if_mask;
|
||||||
uint32_t if_bandwidth;
|
uint32_t if_bandwidth;
|
||||||
uint8_t if_mac[6];
|
uint8_t if_mac[6];
|
||||||
int if_mtu;
|
int ifmtu; /* Can't use if_mtu because of a
|
||||||
|
#define collision on some BSDs */
|
||||||
} opal_if_t;
|
} opal_if_t;
|
||||||
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_if_t);
|
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_if_t);
|
||||||
|
|
||||||
|
@ -42,7 +42,9 @@ AC_DEFUN([MCA_opal_if_posix_ipv4_CONFIG], [
|
|||||||
)
|
)
|
||||||
|
|
||||||
AS_IF([test "$opal_if_posix_ipv4_happy" = "yes"],
|
AS_IF([test "$opal_if_posix_ipv4_happy" = "yes"],
|
||||||
[AC_CHECK_MEMBERS([struct ifreq.ifr_mtu], [], [],
|
[AC_CHECK_MEMBERS([struct ifreq.ifr_hwaddr], [], [],
|
||||||
|
[[#include <net/if.h>]])
|
||||||
|
AC_CHECK_MEMBERS([struct ifreq.ifr_mtu], [], [],
|
||||||
[[#include <net/if.h>]])
|
[[#include <net/if.h>]])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -263,10 +263,10 @@ static int if_posix_open(void)
|
|||||||
/* generate CIDR and assign to netmask */
|
/* generate CIDR and assign to netmask */
|
||||||
intf->if_mask = prefix(((struct sockaddr_in*) &ifr->ifr_addr)->sin_addr.s_addr);
|
intf->if_mask = prefix(((struct sockaddr_in*) &ifr->ifr_addr)->sin_addr.s_addr);
|
||||||
|
|
||||||
#ifdef SIOCGIFHWADDR
|
#if defined(SIOCGIFHWADDR) && defined(HAVE_STRUCT_IFREQ_IFR_HWADDR)
|
||||||
/* get the MAC address */
|
/* get the MAC address */
|
||||||
if (ioctl(sd, SIOCGIFHWADDR, ifr) < 0) {
|
if (ioctl(sd, SIOCGIFHWADDR, ifr) < 0) {
|
||||||
opal_output(0, "btl_usnic_opal_ifinit: ioctl(SIOCGIFHWADDR) failed with errno=%d", errno);
|
opal_output(0, "opal_ifinit: ioctl(SIOCGIFHWADDR) failed with errno=%d", errno);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
memcpy(intf->if_mac, ifr->ifr_hwaddr.sa_data, 6);
|
memcpy(intf->if_mac, ifr->ifr_hwaddr.sa_data, 6);
|
||||||
@ -275,10 +275,10 @@ static int if_posix_open(void)
|
|||||||
#if defined(SIOCGIFMTU) && defined(HAVE_STRUCT_IFREQ_IFR_MTU)
|
#if defined(SIOCGIFMTU) && defined(HAVE_STRUCT_IFREQ_IFR_MTU)
|
||||||
/* get the MTU */
|
/* get the MTU */
|
||||||
if (ioctl(sd, SIOCGIFMTU, ifr) < 0) {
|
if (ioctl(sd, SIOCGIFMTU, ifr) < 0) {
|
||||||
opal_output(0, "btl_usnic_opal_ifinit: ioctl(SIOCGIFMTU) failed with errno=%d", errno);
|
opal_output(0, "opal_ifinit: ioctl(SIOCGIFMTU) failed with errno=%d", errno);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
intf->if_mtu = ifr->ifr_mtu;
|
intf->ifmtu = ifr->ifr_mtu;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
opal_list_append(&opal_if_list, &(intf->super));
|
opal_list_append(&opal_if_list, &(intf->super));
|
||||||
|
@ -479,7 +479,7 @@ int opal_ifindextomac(int if_index, uint8_t mac[6])
|
|||||||
* MTU assigned to the interface.
|
* MTU assigned to the interface.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int opal_ifindextomtu(int if_index, int *if_mtu)
|
int opal_ifindextomtu(int if_index, int *mtu)
|
||||||
{
|
{
|
||||||
opal_if_t* intf;
|
opal_if_t* intf;
|
||||||
|
|
||||||
@ -487,7 +487,7 @@ int opal_ifindextomtu(int if_index, int *if_mtu)
|
|||||||
intf != (opal_if_t*)opal_list_get_end(&opal_if_list);
|
intf != (opal_if_t*)opal_list_get_end(&opal_if_list);
|
||||||
intf = (opal_if_t*)opal_list_get_next(intf)) {
|
intf = (opal_if_t*)opal_list_get_next(intf)) {
|
||||||
if (intf->if_index == if_index) {
|
if (intf->if_index == if_index) {
|
||||||
*if_mtu = intf->if_mtu;
|
*mtu = intf->ifmtu;
|
||||||
return OPAL_SUCCESS;
|
return OPAL_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ OPAL_DECLSPEC int opal_ifindextomac(int if_index, uint8_t if_mac[6]);
|
|||||||
* @param if_index (IN) Interface index
|
* @param if_index (IN) Interface index
|
||||||
* @param if_mtu (OUT) Interface's MTU
|
* @param if_mtu (OUT) Interface's MTU
|
||||||
*/
|
*/
|
||||||
OPAL_DECLSPEC int opal_ifindextomtu(int if_index, int *if_mtu);
|
OPAL_DECLSPEC int opal_ifindextomtu(int if_index, int *mtu);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lookup an interface by index and return its flags.
|
* Lookup an interface by index and return its flags.
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user