]> git.openfabrics.org - ~shefty/librdmacm.git/commitdiff
librdmacm: Return an error if user specifies AF_IB but it is not supported
authorSean Hefty <sean.hefty@intel.com>
Fri, 30 Sep 2011 16:17:04 +0000 (09:17 -0700)
committerSean Hefty <sean.hefty@intel.com>
Fri, 2 Mar 2012 01:10:10 +0000 (17:10 -0800)
If the user specifies an AF_IB address into rdma_bind_addr,
rdma_resolve_addr, rdma_join_multicast, or rdma_leave_multicast,
but the kernel does not support AF_IB return an error.

Note that rdma_getaddrinfo will never return an AF_IB address to the
user unless kernel support is present.  A application would need
to construct and AF_IB address by hand before making one of the
above mentioned calls.  This check prevents overrunning the
command buffer written to the kernel.

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

index ad4ef3f47676f49c3838a6dc028c122078891b62..df18684b69872dc1fa11f64505bdbfd6ade968a2 100755 (executable)
--- a/src/cma.c
+++ b/src/cma.c
@@ -516,7 +516,7 @@ static int ucma_addrlen(struct sockaddr *addr)
        case PF_INET6:
                return sizeof(struct sockaddr_in6);
        case PF_IB:
-               return sizeof(struct sockaddr_ib);
+               return af_ib_support ? sizeof(struct sockaddr_ib) : 0;
        default:
                return 0;
        }