Blob Blame History Raw
From a7754ab3fc01b99a4963c786ee1dc1349a5d35e0 Mon Sep 17 00:00:00 2001
From: Hal Rosenstock <hal@dev.mellanox.co.il>
Date: Thu, 13 Apr 2017 10:48:00 -0400
Subject: [PATCH 1/3] srp_daemon/srp_daemon.c: Don't rely on attribute offset,
 in get_shared_pkeys

get_shared_pkeys has been using SubAdmGet rather than SubAdmGetTable since
commit 2ad09524931dbf98d412e1912c1bdbf22f8ac81d
srp_daemon: Work around SM bug over non-default P_Key support

so RMPP is no longer used in response so it's not safe to
rely on AttributeOffset field. Good MAD status is sufficient
to say that valid PathRecord was returned.

Found-by: Honggang LI <honli@redhat.com>
using embedded subnet manager running on an Intel True Scale
Edge Switch 12300.

This has been broken since srptools-1.0.1 which was first
release containing commit mentioned above.

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
Signed-off-by: Honggang Li <honli@redhat.com>
---
 srp_daemon/srp_daemon.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon.c
index 0c8bda3..76fec28 100644
--- a/srp_daemon/srp_daemon.c
+++ b/srp_daemon/srp_daemon.c
@@ -1102,7 +1102,6 @@ static int get_shared_pkeys(struct resources *res,
 	struct srp_dm_rmpp_sa_mad      *out_sa_mad, *in_sa_mad;
 	ib_path_rec_t		       *path_rec;
 	ssize_t len;
-	int size;
 	int i, num_pkeys = 0;
 	uint16_t pkey;
 	uint16_t local_port_lid = get_port_lid(res->ud_res->ib_ctx,
@@ -1148,14 +1147,6 @@ static int get_shared_pkeys(struct resources *res,
 		if (len < 0)
 			goto err;
 
-		size = ib_get_attr_size(in_sa_mad->attr_offset);
-		if (!size) {
-			if (config->verbose)
-				printf("PathRec Query did not find any targets "
-				       "over P_Key %x\n", pkey);
-			continue;
-		}
-
 		path_rec = (ib_path_rec_t *)in_sa_mad->data;
 		pkeys[num_pkeys++] = be16toh(path_rec->pkey);
 	}
-- 
1.8.3.1