]> git.openfabrics.org - ~shefty/librdmacm.git/commitdiff
librdmacm/rsocket: Succeed setsockopt REUSEADDR on connected sockets
authorSean Hefty <sean.hefty@intel.com>
Thu, 10 May 2012 18:17:32 +0000 (11:17 -0700)
committerSean Hefty <sean.hefty@intel.com>
Thu, 10 May 2012 18:17:32 +0000 (11:17 -0700)
The RDMA CM fail calls to set REUSEADDR on an rdma_cm_id if
it is not in the idle state.  As a result, this causes a failure
in NetPipe when run with socket calls intercepted by rsockets.
Fix this by returning success when REUSEADDR is set on an rsocket
that has already been connected.  When running over IB, REUSEADDR
is not necessary, since the TCP/IP addresses are mapped.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
src/rsocket.c

index 2ffde9bb224e434de64049963c1202f0ac6c8320..de0ec3e50f47d88fd649e077bf5366d43e88a4b0 100644 (file)
@@ -1621,7 +1621,9 @@ int rsetsockopt(int socket, int level, int optname,
                        ret = rdma_set_option(rs->cm_id, RDMA_OPTION_ID,
                                              RDMA_OPTION_ID_REUSEADDR,
                                              (void *) optval, optlen);
-                       if (ret && errno == ENOSYS)
+                       if (ret && ((errno == ENOSYS) || ((rs->state != rs_init) &&
+                           rs->cm_id->context &&
+                           (rs->cm_id->verbs->device->transport_type == IBV_TRANSPORT_IB))))
                                ret = 0;
                        opt_on = *(int *) optval;
                        break;