Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2007-10-26 12:50:47


George --

Can you send me a writeup on how this stuff works? I can add it to
the FAQ.

Thanks!

On Oct 26, 2007, at 12:36 PM, bosilca_at_[hidden] wrote:

> Author: bosilca
> Date: 2007-10-26 12:36:51 EDT (Fri, 26 Oct 2007)
> New Revision: 16584
> URL: https://svn.open-mpi.org/trac/ompi/changeset/16584
>
> Log:
> Restrict the port range for the OOB and the BTL. Each protocols (v4
> and v6)
> has his own range which is defined by a min value and a range. By
> default
> there is no limitation on the port range, which is exactly the same
> behavior as before.
>
> Text files modified:
> trunk/ompi/mca/btl/tcp/btl_tcp.h | 11 +
> trunk/ompi/mca/btl/tcp/btl_tcp_component.c | 146 ++++++++++++++
> ++++++---------
> trunk/orte/mca/oob/tcp/oob_tcp.c | 189 ++++++++++++++
> ++++++++++++++-----------
> trunk/orte/mca/oob/tcp/oob_tcp.h | 14 ++
> 4 files changed, 254 insertions(+), 106 deletions(-)
>
> Modified: trunk/ompi/mca/btl/tcp/btl_tcp.h
> ======================================================================
> ========
> --- trunk/ompi/mca/btl/tcp/btl_tcp.h (original)
> +++ trunk/ompi/mca/btl/tcp/btl_tcp.h 2007-10-26 12:36:51 EDT (Fri,
> 26 Oct 2007)
> @@ -70,16 +70,21 @@
> opal_hash_table_t tcp_procs; /**< hash table of tcp
> proc structures */
> opal_list_t tcp_events; /**< list of pending
> tcp events */
> opal_mutex_t tcp_lock; /**< lock for
> accessing module state */
> +
> opal_event_t tcp_recv_event; /**< recv event for
> IPv4 listen socket */
> -#if OPAL_WANT_IPV6
> - opal_event_t tcp6_recv_event; /**< recv event for
> IPv6 listen socket */
> -#endif
> int tcp_listen_sd; /**< IPv4 listen
> socket for incoming connection requests */
> unsigned short tcp_listen_port; /**< IPv4 listen port */
> + int32_t tcp_port_min; /**< IPv4 minimum port */
> + int32_t tcp_port_range; /**< IPv4 port range */
> #if OPAL_WANT_IPV6
> + opal_event_t tcp6_recv_event; /**< recv event for
> IPv6 listen socket */
> int tcp6_listen_sd; /**< IPv6 listen
> socket for incoming connection requests */
> unsigned short tcp6_listen_port; /**< IPv6 listen port */
> + int32_t tcp6_port_min; /**< IPv4 minimum port */
> + int32_t tcp6_port_range; /**< IPv4 port range */
> #endif
> + /* Port range restriction */
> +
> char* tcp_if_include; /**< comma seperated
> list of interface to include */
> char* tcp_if_exclude; /**< comma seperated
> list of interface to exclude */
> int tcp_sndbuf; /**< socket sndbuf
> size */
>
> Modified: trunk/ompi/mca/btl/tcp/btl_tcp_component.c
> ======================================================================
> ========
> --- trunk/ompi/mca/btl/tcp/btl_tcp_component.c (original)
> +++ trunk/ompi/mca/btl/tcp/btl_tcp_component.c 2007-10-26 12:36:51
> EDT (Fri, 26 Oct 2007)
> @@ -217,10 +217,33 @@
> mca_btl_tcp_component.tcp_rcvbuf =
> mca_btl_tcp_param_register_int ("rcvbuf", NULL, 128*1024);
> mca_btl_tcp_component.tcp_endpoint_cache =
> - mca_btl_tcp_param_register_int ("endpoint_cache", NULL,
> 30*1024);
> + mca_btl_tcp_param_register_int ("endpoint_cache",
> + "The size of the internal cache for each TCP
> connection. This cache is"
> + " used to reduce the number of syscalls, by replacing
> them with memcpy."
> + " Every read will read the expected data plus the
> amount of the"
> + " endpoint_cache", 30*1024);
> mca_btl_tcp_component.tcp_use_nodelay =
> !mca_btl_tcp_param_register_int ("use_nagle", "Whether to
> use Nagle's algorithm or not (using Nagle's algorithm may increase
> short message latency)", 0);
> -
> + mca_btl_tcp_component.tcp_port_min =
> + mca_btl_tcp_param_register_int( "port_min_v4",
> + "The minimum port where the TCP BTL will try to bind
> (default 0)", 0 );
> + mca_btl_tcp_component.tcp_port_range =
> + mca_btl_tcp_param_register_int( "port_range_v4",
> + "The number of ports where the TCP BTL will try to
> bind (default 64K)."
> + " This parameter together with the port min, define a
> range of ports"
> + " where Open MPI will open sockets.",
> + 64*1024 - mca_btl_tcp_component.tcp_port_min - 1);
> +#if OPAL_WANT_IPV6
> + mca_btl_tcp_component.tcp6_port_min =
> + mca_btl_tcp_param_register_int( "port_min_v6",
> + "The minimum port where the TCP BTL will try to bind
> (default 0)", 0 );
> + mca_btl_tcp_component.tcp6_port_range =
> + mca_btl_tcp_param_register_int( "port_range_v6",
> + "The number of ports where the TCP BTL will try to
> bind (default 64K)."
> + " This parameter together with the port min, define a
> range of ports"
> + " where Open MPI will open sockets.",
> + 64*1024 - mca_btl_tcp_component.tcp6_port_min - 1);
> +#endif
> mca_btl_tcp_module.super.btl_exclusivity =
> MCA_BTL_EXCLUSIVITY_LOW;
> mca_btl_tcp_module.super.btl_eager_limit = 64*1024;
> mca_btl_tcp_module.super.btl_min_send_size = 64*1024;
> @@ -482,11 +505,7 @@
> {
> int flags;
> int sd;
> -#if OPAL_WANT_IPV6
> - struct sockaddr_in6 inaddr;
> -#else
> - struct sockaddr_in inaddr;
> -#endif
> + struct sockaddr_storage inaddr;
> opal_socklen_t addrlen;
>
> /* create a listen socket for incoming connections */
> @@ -499,24 +518,8 @@
> return OMPI_ERR_IN_ERRNO;
> }
>
> - /* we now have a socket. Assign it to the real
> mca_btl_tcp_component */
> -#if OPAL_WANT_IPV6
> - if (AF_INET6 == af_family) {
> - mca_btl_tcp_component.tcp6_listen_sd = sd;
> - addrlen = sizeof(struct sockaddr_in6);
> - } else {
> - mca_btl_tcp_component.tcp_listen_sd = sd;
> - addrlen = sizeof(struct sockaddr_in);
> - }
> -#else
> - mca_btl_tcp_component.tcp_listen_sd = sd;
> - addrlen = sizeof(struct sockaddr_in);
> -#endif
> -
> mca_btl_tcp_set_socket_options(sd);
>
> - /* bind to all addresses and dynamically assigned port */
> - memset(&inaddr, 0, sizeof(inaddr));
> #if OPAL_WANT_IPV6
> {
> struct addrinfo hints, *res = NULL;
> @@ -531,7 +534,8 @@
> opal_output (0,
> "mca_btl_tcp_create_listen: unable to resolve. %s\n",
> gai_strerror (error));
> - return ORTE_ERROR;
> + CLOSE_THE_SOCKET(sd);
> + return OMPI_ERROR;
> }
>
> memcpy (&inaddr, res->ai_addr, res->ai_addrlen);
> @@ -551,39 +555,93 @@
> #endif /* IPV6_V6ONLY */
> }
> #else
> - inaddr.sin_family = AF_INET;
> - inaddr.sin_addr.s_addr = INADDR_ANY;
> - inaddr.sin_port = 0;
> + ((struct sockaddr_in*) &inaddr)->sin_family = AF_INET;
> + ((struct sockaddr_in*) &inaddr)->sin_addr.s_addr = INADDR_ANY;
> + addrlen = sizeof(struct sockaddr_in);
> #endif
>
> - if(bind(sd, (struct sockaddr*)&inaddr, addrlen) < 0) {
> - BTL_ERROR(("bind() failed: %s (%d)",
> - strerror(opal_socket_errno), opal_socket_errno));
> - return OMPI_ERROR;
> + { /* Don't reuse ports */
> + int flg = 0;
> + if (setsockopt (sd, SOL_SOCKET, SO_REUSEPORT, &flg, sizeof
> (flg)) < 0) {
> + BTL_ERROR((0, "mca_btl_tcp_create_listen: unable to
> unset the "
> + "SO_REUSEADDR option (%s:%d)\n",
> + strerror(opal_socket_errno),
> opal_socket_errno));
> + CLOSE_THE_SOCKET(sd);
> + return OMPI_ERROR;
> + }
> }
>
> + {
> + int index, range, port;
> +
> + if( AF_INET == af_family ) {
> + range = mca_btl_tcp_component.tcp_port_range;
> + port = mca_btl_tcp_component.tcp_port_min;
> + }
> +#if OPAL_WANT_IPV6
> + if (AF_INET6 == af_family) {
> + range = mca_btl_tcp_component.tcp6_port_range;
> + port = mca_btl_tcp_component.tcp6_port_min;
> + }
> +#endif /* OPAL_WANT_IPV6 */
> +
> + for( index = 0; index < range; index++ ) {
> +#if OPAL_WANT_IPV6
> + ((struct sockaddr_in6*) &inaddr)->sin6_port = port +
> index;
> +#else
> + ((struct sockaddr_in*) &inaddr)->sin_port = port + index;
> +#endif /* OPAL_WANT_IPV6 */
> + if(bind(sd, (struct sockaddr*)&inaddr, addrlen) < 0) {
> + if( (EADDRINUSE == opal_socket_errno) ||
> (EADDRNOTAVAIL == opal_socket_errno) ) {
> + continue;
> + }
> + BTL_ERROR(("bind() failed: %s (%d)",
> + strerror(opal_socket_errno),
> opal_socket_errno));
> + CLOSE_THE_SOCKET(sd);
> + return OMPI_ERROR;
> + }
> + goto socket_binded;
> + }
> + if( AF_INET == af_family ) {
> + BTL_ERROR(("bind() failed: no port available in the
> range [%d..%d]",
> + mca_btl_tcp_component.tcp_port_min,
> + mca_btl_tcp_component.tcp_port_min + range));
> + }
> +#if OPAL_WANT_IPV6
> + if (AF_INET6 == af_family) {
> + BTL_ERROR(("bind6() failed: no port available in the
> range [%d..%d]",
> + mca_btl_tcp_component.tcp6_port_min,
> + mca_btl_tcp_component.tcp6_port_min + range));
> + }
> +#endif /* OPAL_WANT_IPV6 */
> + CLOSE_THE_SOCKET(sd);
> + return OMPI_ERROR;
> + }
> + socket_binded:
> /* resolve system assignend port */
> if(getsockname(sd, (struct sockaddr*)&inaddr, &addrlen) < 0) {
> BTL_ERROR(("getsockname() failed: %s (%d)",
> strerror(opal_socket_errno), opal_socket_errno));
> + CLOSE_THE_SOCKET(sd);
> return OMPI_ERROR;
> }
>
> -#if OPAL_WANT_IPV6
> if (AF_INET == af_family) {
> - mca_btl_tcp_component.tcp_listen_port = inaddr.sin6_port;
> + mca_btl_tcp_component.tcp_listen_port = ((struct
> sockaddr_in*) &inaddr)->sin_port;
> + mca_btl_tcp_component.tcp_listen_sd = sd;
> }
> +#if OPAL_WANT_IPV6
> if (AF_INET6 == af_family) {
> - mca_btl_tcp_component.tcp6_listen_port = inaddr.sin6_port;
> + mca_btl_tcp_component.tcp6_listen_port = ((struct
> sockaddr_in6*) &inaddr)->sin6_port;
> + mca_btl_tcp_component.tcp6_listen_sd = sd;
> }
> -#else
> - mca_btl_tcp_component.tcp_listen_port = inaddr.sin_port;
> #endif
>
> /* setup listen backlog to maximum allowed by kernel */
> if(listen(sd, SOMAXCONN) < 0) {
> BTL_ERROR(("listen() failed: %s (%d)",
> strerror(opal_socket_errno), opal_socket_errno));
> + CLOSE_THE_SOCKET(sd);
> return OMPI_ERROR;
> }
>
> @@ -591,42 +649,36 @@
> if((flags = fcntl(sd, F_GETFL, 0)) < 0) {
> BTL_ERROR(("fcntl(F_GETFL) failed: %s (%d)",
> strerror(opal_socket_errno), opal_socket_errno));
> + CLOSE_THE_SOCKET(sd);
> return OMPI_ERROR;
> } else {
> flags |= O_NONBLOCK;
> if(fcntl(sd, F_SETFL, flags) < 0) {
> BTL_ERROR(("fcntl(F_SETFL) failed: %s (%d)",
> strerror(opal_socket_errno),
> opal_socket_errno));
> + CLOSE_THE_SOCKET(sd);
> return OMPI_ERROR;
> }
> }
>
> /* register listen port */
> -#if OPAL_WANT_IPV6
> if (AF_INET == af_family) {
> opal_event_set( &mca_btl_tcp_component.tcp_recv_event,
> - sd,
> + mca_btl_tcp_component.tcp_listen_sd,
> OPAL_EV_READ|OPAL_EV_PERSIST,
> mca_btl_tcp_component_accept_handler,
> 0 );
> opal_event_add(&mca_btl_tcp_component.tcp_recv_event, 0);
> }
> -
> +#if OPAL_WANT_IPV6
> if (AF_INET6 == af_family) {
> opal_event_set( &mca_btl_tcp_component.tcp6_recv_event,
> - sd,
> + mca_btl_tcp_component.tcp6_listen_sd,
> OPAL_EV_READ|OPAL_EV_PERSIST,
> mca_btl_tcp_component_accept_handler,
> 0 );
> opal_event_add(&mca_btl_tcp_component.tcp6_recv_event, 0);
> }
> -#else
> - opal_event_set( &mca_btl_tcp_component.tcp_recv_event,
> - mca_btl_tcp_component.tcp_listen_sd,
> - OPAL_EV_READ|OPAL_EV_PERSIST,
> - mca_btl_tcp_component_accept_handler,
> - 0 );
> - opal_event_add(&mca_btl_tcp_component.tcp_recv_event,0);
> #endif
> return OMPI_SUCCESS;
> }
>
> Modified: trunk/orte/mca/oob/tcp/oob_tcp.c
> ======================================================================
> ========
> --- trunk/orte/mca/oob/tcp/oob_tcp.c (original)
> +++ trunk/orte/mca/oob/tcp/oob_tcp.c 2007-10-26 12:36:51 EDT (Fri,
> 26 Oct 2007)
> @@ -356,10 +356,33 @@
> 10,
>
> &mca_oob_tcp_component.tcp_copy_spin_count);
>
> + mca_base_param_reg_int(&mca_oob_tcp_component.super.oob_base,
> + "port_min_v4", "Starting port allowed
> (IPv4)",
> + false, false,
> + 0,
> + &mca_oob_tcp_component.tcp_port_min);
> + mca_base_param_reg_int(&mca_oob_tcp_component.super.oob_base,
> + "port_range_v4", "Range of allowed
> ports (IPv4)",
> + false, false,
> + 64*1024 - 1 -
> mca_oob_tcp_component.tcp_port_min,
> + &mca_oob_tcp_component.tcp_port_range);
> +#if OPAL_WANT_IPV6
> + mca_base_param_reg_int(&mca_oob_tcp_component.super.oob_base,
> + "port_min_v6", "Starting port allowed
> (IPv6)",
> + false, false,
> + 0,
> + &mca_oob_tcp_component.tcp6_port_min);
> + mca_base_param_reg_int(&mca_oob_tcp_component.super.oob_base,
> + "port_range_v6", "Range of allowed
> ports (IPv6)",
> + false, false,
> + 64*1024 - 1 -
> mca_oob_tcp_component.tcp6_port_min,
> + &mca_oob_tcp_component.tcp6_port_range);
> + mca_oob_tcp_component.tcp6_listen_sd = -1;
> +#endif /* OPAL_WANT_IPV6 */
> +
> /* initialize state */
> mca_oob_tcp_component.tcp_shutdown = false;
> mca_oob_tcp_component.tcp_listen_sd = -1;
> - mca_oob_tcp_component.tcp6_listen_sd = -1;
> mca_oob_tcp_component.tcp_match_count = 0;
>
> mca_oob_tcp_component.tcp_last_copy_time = 0;
> @@ -471,14 +494,9 @@
> int flags;
> struct sockaddr_storage inaddr;
> opal_socklen_t addrlen;
> -#if OPAL_WANT_IPV6
> - struct addrinfo hints, *res = NULL;
> - int error;
> -#endif
>
> /* create a listen socket for incoming connections */
> *target_sd = socket(af_family, SOCK_STREAM, 0);
> -
> if(*target_sd < 0) {
> if (EAFNOSUPPORT != opal_socket_errno) {
> opal_output(0,"mca_oob_tcp_component_init: socket()
> failed: %s (%d)",
> @@ -490,69 +508,125 @@
> /* setup socket options */
> mca_oob_tcp_set_socket_options(*target_sd);
>
> - /* bind address */
> - memset(&inaddr, 0, sizeof(inaddr));
> #if OPAL_WANT_IPV6
> - memset(&hints, 0, sizeof(hints));
> - hints.ai_family = af_family;
> - hints.ai_socktype = SOCK_STREAM;
> - hints.ai_flags = AI_PASSIVE;
> + {
> + struct addrinfo hints, *res = NULL;
> + int error;
> +
> + memset(&hints, 0, sizeof(hints));
> + hints.ai_family = af_family;
> + hints.ai_socktype = SOCK_STREAM;
> + hints.ai_flags = AI_PASSIVE;
>
> - if ((error = getaddrinfo(NULL, "0", &hints, &res))) {
> - opal_output (0,
> - "mca_oob_tcp_create_listen: unable to
> resolve. %s\n",
> - gai_strerror (error));
> - return ORTE_ERROR;
> - }
> + if ((error = getaddrinfo(NULL, "0", &hints, &res))) {
> + opal_output (0,
> + "mca_oob_tcp_create_listen: unable to
> resolve. %s\n",
> + gai_strerror (error));
> + return ORTE_ERROR;
> + }
>
> - memcpy (&inaddr, res->ai_addr, res->ai_addrlen);
> - addrlen = res->ai_addrlen;
> - freeaddrinfo (res);
> + memcpy (&inaddr, res->ai_addr, res->ai_addrlen);
> + addrlen = res->ai_addrlen;
> + freeaddrinfo (res);
>
> #ifdef IPV6_V6ONLY
> - /* in case of AF_INET6, disable v4-mapped addresses */
> - if (AF_INET6 == af_family) {
> - int flg = 0;
> - if (setsockopt (*target_sd, IPPROTO_IPV6, IPV6_V6ONLY,
> - &flg, sizeof (flg)) < 0) {
> - opal_output(0,
> - "mca_oob_tcp_create_listen: unable to
> disable v4-mapped addresses\n");
> + /* in case of AF_INET6, disable v4-mapped addresses */
> + if (AF_INET6 == af_family) {
> + int flg = 0;
> + if (setsockopt (*target_sd, IPPROTO_IPV6, IPV6_V6ONLY,
> + &flg, sizeof (flg)) < 0) {
> + opal_output(0,
> + "mca_oob_tcp_create_listen: unable to
> disable v4-mapped addresses\n");
> + }
> }
> }
> #endif /* IPV6_V6ONLY */
> #else
> - if (AF_INET == af_family) {
> - struct sockaddr_in * in = (struct sockaddr_in*) &inaddr;
> - in->sin_family = af_family;
> - in->sin_addr.s_addr = INADDR_ANY;
> - in->sin_port = 0;
> - addrlen = sizeof(struct sockaddr_in);
> - } else {
> + if (AF_INET != af_family) {
> return ORTE_ERROR;
> }
> + ((struct sockaddr_in*) &inaddr)->sin_family = af_family;
> + ((struct sockaddr_in*) &inaddr)->sin_addr.s_addr = INADDR_ANY;
> + addrlen = sizeof(struct sockaddr_in);
> #endif
>
> - if (bind(*target_sd, (struct sockaddr*)&inaddr, addrlen) < 0) {
> - opal_output(0,"mca_oob_tcp_create_listen: bind() failed: %
> s (%d)",
> - strerror(opal_socket_errno), opal_socket_errno);
> - return ORTE_ERROR;
> + { /* Don't reuse ports */
> + int flg = 0;
> + if (setsockopt (*target_sd, SOL_SOCKET, SO_REUSEPORT,
> &flg, sizeof (flg)) < 0) {
> + opal_output(0, "mca_oob_tcp_create_listen: unable to
> unset the "
> + "SO_REUSEADDR option (%s:%d)\n",
> + strerror(opal_socket_errno),
> opal_socket_errno);
> + CLOSE_THE_SOCKET(*target_sd);
> + return ORTE_ERROR;
> + }
> }
>
> + {
> + int index, range, port;
> +
> + if( AF_INET == af_family ) {
> + range = mca_oob_tcp_component.tcp_port_range;
> + port = mca_oob_tcp_component.tcp_port_min;
> + }
> +#if OPAL_WANT_IPV6
> + if (AF_INET6 == af_family) {
> + range = mca_oob_tcp_component.tcp6_port_range;
> + port = mca_oob_tcp_component.tcp6_port_min;
> + }
> +#endif /* OPAL_WANT_IPV6 */
> +
> + for( index = 0; index < range; index++ ) {
> +#if OPAL_WANT_IPV6
> + ((struct sockaddr_in6*) &inaddr)->sin6_port = port +
> index;
> +#else
> + ((struct sockaddr_in*) &inaddr)->sin_port = port + index;
> +#endif /* OPAL_WANT_IPV6 */
> + if(bind(*target_sd, (struct sockaddr*)&inaddr,
> addrlen) < 0) {
> + if( (EADDRINUSE == opal_socket_errno) ||
> (EADDRNOTAVAIL == opal_socket_errno) ) {
> + continue;
> + }
> + opal_output( 0, "bind() failed: %s (%d)",
> + strerror(opal_socket_errno),
> opal_socket_errno );
> + CLOSE_THE_SOCKET(*target_sd);
> + return ORTE_ERROR;
> + }
> + goto socket_binded;
> + }
> + if( AF_INET == af_family ) {
> + opal_output( 0, "bind() failed: no port available in
> the range [%d..%d]",
> + mca_oob_tcp_component.tcp_port_min,
> + mca_oob_tcp_component.tcp_port_min + range);
> + }
> +#if OPAL_WANT_IPV6
> + if (AF_INET6 == af_family) {
> + opal_output( 0, "bind6() failed: no port available in
> the range [%d..%d]",
> + mca_oob_tcp_component.tcp6_port_min,
> + mca_oob_tcp_component.tcp6_port_min +
> range );
> + }
> +#endif /* OPAL_WANT_IPV6 */
> + CLOSE_THE_SOCKET(*target_sd);
> + return ORTE_ERROR;
> + }
> + socket_binded:
> /* resolve system assigned port */
> if (getsockname(*target_sd, (struct sockaddr*)&inaddr,
> &addrlen) < 0) {
> opal_output(0, "mca_oob_tcp_create_listen: getsockname(): %
> s (%d)",
> strerror(opal_socket_errno), opal_socket_errno);
> + CLOSE_THE_SOCKET(*target_sd);
> return ORTE_ERROR;
> }
>
> if (AF_INET == af_family) {
> - mca_oob_tcp_component.tcp_listen_port =
> - ((struct sockaddr_in*) &inaddr)->sin_port;
> - } else if (AF_INET6 == af_family) {
> - mca_oob_tcp_component.tcp6_listen_port =
> - ((struct sockaddr_in6*) &inaddr)->sin6_port;
> + mca_oob_tcp_component.tcp_listen_port = ((struct
> sockaddr_in*) &inaddr)->sin_port;
> + mca_oob_tcp_component.tcp_listen_sd = *target_sd;
> }
> -
> +#if OPAL_WANT_IPV6
> + if (AF_INET6 == af_family) {
> + mca_oob_tcp_component.tcp6_listen_port = ((struct
> sockaddr_in6*) &inaddr)->sin6_port;
> + mca_oob_tcp_component.tcp6_listen_sd = *target_sd;
> + }
> +#endif /* OPAL_WANT_IPV6 */
> +
> /* setup listen backlog to maximum allowed by kernel */
> if(listen(*target_sd, SOMAXCONN) < 0) {
> opal_output(0, "mca_oob_tcp_component_init: listen(): %s (%
> d)",
> @@ -582,7 +656,9 @@
> mca_oob_tcp_recv_handler,
> 0);
> opal_event_add(&mca_oob_tcp_component.tcp_recv_event, 0);
> - } else if (AF_INET6 == af_family) {
> + }
> +#if OPAL_WANT_IPV6
> + if (AF_INET6 == af_family) {
> opal_event_set(&mca_oob_tcp_component.tcp6_recv_event,
> *target_sd,
> OPAL_EV_READ|OPAL_EV_PERSIST,
> @@ -590,7 +666,7 @@
> 0);
> opal_event_add(&mca_oob_tcp_component.tcp6_recv_event, 0);
> }
> -
> +#endif /* OPAL_WANT_IPV6 */
> return ORTE_SUCCESS;
> }
>
> @@ -909,8 +985,11 @@
> int rc;
>
> /* accept new connections on the listen socket */
> - if((mca_oob_tcp_component.tcp_listen_sd == sd) ||
> - (mca_oob_tcp_component.tcp6_listen_sd == sd)) {
> + if( (mca_oob_tcp_component.tcp_listen_sd == sd)
> +#if OPAL_WANT_IPV6
> + || (mca_oob_tcp_component.tcp6_listen_sd == sd)
> +#endif /* OPAL_WANT_IPV6 */
> + ) {
> mca_oob_tcp_accept(sd);
> return;
> }
> @@ -1040,8 +1119,9 @@
>
> /* intialize event library */
> memset(&mca_oob_tcp_component.tcp_recv_event, 0, sizeof
> (opal_event_t));
> +#if OPAL_WANT_IPV6
> memset(&mca_oob_tcp_component.tcp6_recv_event, 0, sizeof
> (opal_event_t));
> -
> +#endif /* OPAL_WANT_IPV6 */
> return &mca_oob_tcp;
> }
>
> @@ -1161,12 +1241,14 @@
> if (OOB_TCP_EVENT == mca_oob_tcp_component.tcp_listen_type) {
> opal_event_del(&mca_oob_tcp_component.tcp_recv_event);
> CLOSE_THE_SOCKET(mca_oob_tcp_component.tcp_listen_sd);
> -
> + mca_oob_tcp_component.tcp_listen_sd = -1;
> +#if OPAL_WANT_IPV6
> if (mca_oob_tcp_component.tcp6_listen_sd >= 0) {
> opal_event_del
> (&mca_oob_tcp_component.tcp6_recv_event);
> CLOSE_THE_SOCKET
> (mca_oob_tcp_component.tcp6_listen_sd);
> mca_oob_tcp_component.tcp6_listen_sd = -1;
> }
> +#endif /* OPAL_WANT_IPV6 */
> } else if (OOB_TCP_LISTEN_THREAD ==
> mca_oob_tcp_component.tcp_listen_type) {
> void *data;
> /* adi_at_2007-04-12: Bug, FIXME:
> @@ -1251,10 +1333,13 @@
> if (dev->if_addr.ss_family == AF_INET) {
> ptr += sprintf(ptr, "tcp://%s:%d",
> opal_net_get_hostname((struct sockaddr*) &dev->if_addr),
> ntohs
> (mca_oob_tcp_component.tcp_listen_port));
> - } else if (dev->if_addr.ss_family == AF_INET6) {
> + }
> +#if OPAL_WANT_IPV6
> + if (dev->if_addr.ss_family == AF_INET6) {
> ptr += sprintf(ptr, "tcp6://%s:%d",
> opal_net_get_hostname((struct sockaddr*) &dev->if_addr),
> ntohs
> (mca_oob_tcp_component.tcp6_listen_port));
> }
> +#endif /* OPAL_WANT_IPV6 */
> }
> return contact_info;
> }
>
> Modified: trunk/orte/mca/oob/tcp/oob_tcp.h
> ======================================================================
> ========
> --- trunk/orte/mca/oob/tcp/oob_tcp.h (original)
> +++ trunk/orte/mca/oob/tcp/oob_tcp.h 2007-10-26 12:36:51 EDT (Fri,
> 26 Oct 2007)
> @@ -196,10 +196,6 @@
> mca_oob_base_component_1_0_0_t super; /**< base OOB component */
> char* tcp_include; /**< list of ip
> interfaces to include */
> char* tcp_exclude; /**< list of ip
> interfaces to exclude */
> - int tcp_listen_sd; /**< listen socket
> for incoming IPv4 connection requests */
> - unsigned short tcp_listen_port; /**< IPv4 listen port */
> - int tcp6_listen_sd; /**< listen socket
> for incoming IPv6 connection requests */
> - unsigned short tcp6_listen_port; /**< IPv6 listen port */
> opal_list_t tcp_peer_list; /**< list of peers
> sorted in mru order */
> opal_hash_table_t tcp_peers; /**< peers sorted by
> name */
> opal_hash_table_t tcp_peer_names; /**< cache of peer
> contact info sorted by name */
> @@ -210,7 +206,17 @@
> int tcp_rcvbuf; /**< socket recv
> buffer size */
> opal_free_list_t tcp_msgs; /**< free list of
> messages */
> opal_event_t tcp_recv_event; /**< event structure
> for IPv4 recvs */
> + int tcp_listen_sd; /**< listen socket
> for incoming IPv4 connection requests */
> + unsigned short tcp_listen_port; /**< IPv4 listen port */
> + int tcp_port_min; /**< Minimum allowed
> port for the OOB listen socket */
> + int tcp_port_range; /**< Range of allowed
> TCP ports */
> +#if OPAL_WANT_IPV6
> opal_event_t tcp6_recv_event; /**< event structure
> for IPv6 recvs */
> + int tcp6_listen_sd; /**< listen socket
> for incoming IPv6 connection requests */
> + unsigned short tcp6_listen_port; /**< IPv6 listen port */
> + int tcp6_port_min; /**< Minimum allowed
> port for the OOB listen socket */
> + int tcp6_port_range; /**< Range of allowed
> TCP ports */
> +#endif /* OPAL_WANT_IPV6 */
> opal_mutex_t tcp_lock; /**< lock for
> accessing module state */
> opal_list_t tcp_events; /**< list of pending
> events (accepts) */
> opal_list_t tcp_msg_post; /**< list of recieves
> user has posted */
> _______________________________________________
> svn-full mailing list
> svn-full_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/svn-full

-- 
Jeff Squyres
Cisco Systems