[openib-general] [PATCH] osm: osm_vendor_umad registers to all SubnMgt methods

Eitan Zahavi eitan at mellanox.co.il
Sat Aug 20 23:56:46 PDT 2005


Hi Hal

In case of registering to a non SubnAdm class the umad vendor layer
osm_vendor_bind() is registering to ALL the methods.
This prevents from multiple clients of SubnMgt (for example) to use
the code. OpenSM osm_sm_mad_ctrl.c actually sets the correct methods
bits (except for registering as report processor - which it is not).

So the patch below prevents the "blind" registration to all methods
in case of a !SubnAdm osm_vendor_bind(). 

Thanks

Eitan

I tested the patch on :
2.6.12.3-smp SuSE Linux 9.3 (i586)

Signed-off-by:  Eitan Zahavi <eitan at mellanox.co.il>

Index: osm/libvendor/osm_vendor_ibumad.c
===================================================================
--- osm/libvendor/osm_vendor_ibumad.c	(revision 3128)
+++ osm/libvendor/osm_vendor_ibumad.c	(working copy)
@@ -708,25 +714,21 @@ osm_vendor_bind(
 	p_bind->p_mad_pool = p_mad_pool;
 	p_bind->port_guid = port_guid;
 
-	if (p_user_bind->mad_class != IB_MCLASS_SUBN_ADM)
-		memset(method_mask, 0xff, sizeof method_mask);	/* accept all methods */
-	else {
-		memset(method_mask, 0, sizeof method_mask);
-		if (p_user_bind->is_responder) {
-			set_bit(IB_MAD_METHOD_GET, &method_mask);
-			set_bit(IB_MAD_METHOD_SET, &method_mask);
-			set_bit(IB_MAD_METHOD_GETTABLE, &method_mask);
-			set_bit(IB_MAD_METHOD_DELETE, &method_mask);
-			/* Add in IB_MAD_METHOD_GETTRACETABLE */
-			/* and IB_MAD_METHOD_GETMULTI when    */
-			/* supported by OpenSM                */
-		}
-		if (p_user_bind->is_report_processor)
-			set_bit(IB_MAD_METHOD_REPORT, &method_mask);
-		if (p_user_bind->is_trap_processor) {
-			set_bit(IB_MAD_METHOD_TRAP, &method_mask);
-			set_bit(IB_MAD_METHOD_TRAP_REPRESS, &method_mask);
-		}
+	memset(method_mask, 0, sizeof method_mask);
+	if (p_user_bind->is_responder) {
+		set_bit(IB_MAD_METHOD_GET, &method_mask);
+		set_bit(IB_MAD_METHOD_SET, &method_mask);
+		set_bit(IB_MAD_METHOD_GETTABLE, &method_mask);
+		set_bit(IB_MAD_METHOD_DELETE, &method_mask);
+		/* Add in IB_MAD_METHOD_GETTRACETABLE */
+		/* and IB_MAD_METHOD_GETMULTI when	  */
+		/* supported by OpenSM					  */
+	} 
+	if (p_user_bind->is_report_processor)
+		set_bit(IB_MAD_METHOD_REPORT, &method_mask);
+	if (p_user_bind->is_trap_processor) {
+		set_bit(IB_MAD_METHOD_TRAP, &method_mask);
+		set_bit(IB_MAD_METHOD_TRAP_REPRESS, &method_mask);
 	}
 
 #ifndef VENDOR_RMPP_SUPPORT
Index: osm/opensm/osm_sm_mad_ctrl.c
===================================================================
--- osm/opensm/osm_sm_mad_ctrl.c	(revision 3128)
+++ osm/opensm/osm_sm_mad_ctrl.c	(working copy)
@@ -1015,7 +1015,7 @@ osm_sm_mad_ctrl_bind(
   }
 
   bind_info.class_version = 1;
-  bind_info.is_report_processor = TRUE;
+  bind_info.is_report_processor = FALSE;
   bind_info.is_responder = TRUE;
   bind_info.is_trap_processor = TRUE;
   bind_info.mad_class = IB_MCLASS_SUBN_DIR;




More information about the general mailing list