From 4038834dfb0b1c76739e28ed3f0fda168d32f6e0 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Tue, 7 Jul 2009 17:21:28 +0000 Subject: [PATCH] Convert the port number in network order before binding the socket. Thanks to Mariusz Mamonski (mamonski@man.poznan.pl) for the bug report and patch. This commit was SVN r21610. --- ompi/mca/btl/tcp/btl_tcp_component.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ompi/mca/btl/tcp/btl_tcp_component.c b/ompi/mca/btl/tcp/btl_tcp_component.c index b6105de271..1f3bb2cfd3 100644 --- a/ompi/mca/btl/tcp/btl_tcp_component.c +++ b/ompi/mca/btl/tcp/btl_tcp_component.c @@ -702,9 +702,9 @@ static int mca_btl_tcp_component_create_listen(uint16_t af_family) for( index = 0; index < range; index++ ) { #if OPAL_WANT_IPV6 - ((struct sockaddr_in6*) &inaddr)->sin6_port = port + index; + ((struct sockaddr_in6*) &inaddr)->sin6_port = htons(port + index); #else - ((struct sockaddr_in*) &inaddr)->sin_port = port + index; + ((struct sockaddr_in*) &inaddr)->sin_port = htons(port + index); #endif /* OPAL_WANT_IPV6 */ if(bind(sd, (struct sockaddr*)&inaddr, addrlen) < 0) { if( (EADDRINUSE == opal_socket_errno) || (EADDRNOTAVAIL == opal_socket_errno) ) {