[ofa-general] [PATCH] ibsim: Drop vendor MADs and vendor specific SM MADs

sebastien dugue sebastien.dugue at bull.net
Mon Jul 27 04:38:01 PDT 2009



  This is useful for testing applications that send those kind of MADS.

Signed-off-by: Sebastien Dugue <sebastien.dugue at bull.net>
---
 ibsim/sim_mad.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/ibsim/sim_mad.c b/ibsim/sim_mad.c
index 61d4866..b79a5e7 100644
--- a/ibsim/sim_mad.c
+++ b/ibsim/sim_mad.c
@@ -1170,6 +1170,25 @@ int process_packet(Client * cl, void *p, int size, Client ** dcl)
 	if ((response = decode_sim_MAD(cl, r, &rpc, &path, data)) < 0)
 		return -1;
 
+	/* Drop vendor MADs */
+	if (((rpc.mgtclass >= IB_VENDOR_RANGE1_START_CLASS) &&
+	     (rpc.mgtclass <= IB_VENDOR_RANGE1_END_CLASS)) ||
+	    ((rpc.mgtclass >= IB_VENDOR_RANGE2_START_CLASS) &&
+	     (rpc.mgtclass <= IB_VENDOR_RANGE2_END_CLASS))) {
+		IBWARN("ignoring vendor MAD: class 0x%x, attr 0x%x",
+		       rpc.mgtclass, rpc.attr.id);
+		goto _dropped;
+	}
+
+	/* Drop vendor specific SM MADs */
+	if (((rpc.mgtclass == IB_SMI_CLASS) ||
+	     (rpc.mgtclass == IB_SMI_DIRECT_CLASS)) &&
+	    (rpc.attr.id >= 0xff00)) {
+		IBWARN("ignoring vendor specific SM MAD: attr 0x%x",
+		       rpc.attr.id);
+		goto _dropped;
+	}
+
 	if (rpc.method == 0x7) {
 		IBWARN("lid %u got trap repress - dropping", ntohs(r->dlid));
 		*dcl = 0;
-- 
1.6.3.1




More information about the general mailing list