@@ -62,7 +62,7 @@ typedef struct acm_msg cma_acm_msg_t;
static pthread_mutex_t acm_lock = PTHREAD_MUTEX_INITIALIZER;
static int sock = -1;
-static short server_port = 6125;
+static short server_port;
struct ib_connect_hdr {
uint8_t cma_version;
@@ -76,7 +76,7 @@ struct ib_connect_hdr {
#define cma_dst_ip6 dst_addr[0]
};
-static void ucma_set_server_port(void)
+static int ucma_set_server_port(void)
{
FILE *f;
@@ -84,6 +84,7 @@ static void ucma_set_server_port(void)
fscanf(f, "%hu", (unsigned short *) &server_port);
fclose(f);
}
+ return server_port;
}
void ucma_ib_init(void)
@@ -96,7 +97,9 @@ void ucma_ib_init(void)
return;
pthread_mutex_lock(&acm_lock);
- ucma_set_server_port();
+ if (!ucma_set_server_port())
+ goto out;
+
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (sock < 0)
goto out;
The librdmacm will try to connect port 6125 if ibacm.port is not found. The problem is that some other service or application could be using that port and respond with garbage. Rather than falling back to a hard coded port number, if ibacm.port is not found, simply disable ACM support. This has the effect of removing support for older versions of ibacm, unless the port file is created manually. Patch created based on feedback from Doug Ledford and Florian Weimer from RedHat. Signed-off-by: Sean Hefty <sean.hefty@intel.com> --- src/acm.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html