[openib-general] [PATCH] Opensm - Fix bug in trap receiver

Yael Kalka yael at mellanox.co.il
Thu Sep 22 04:43:54 PDT 2005


Hi Hal,

There is a bug in the trap handling in opensm.
Currently - when OpenSM receives a trap, it tries to send a trap
repress even if the OpenSM is not in MASTER state.
Also - if OpenSM receives a trap from its local lid (source_lid is 0),
and it has not yet configured its lid - it should not try to send trap
repress, as this will fail (no destination lid available to define the
path).
Attached is a patch to fix these issues.

Thanks,
Yael


Index: opensm/osm_sm_mad_ctrl.c
===================================================================
--- opensm/osm_sm_mad_ctrl.c	(revision 435)
+++ opensm/osm_sm_mad_ctrl.c	(working copy)
@@ -591,6 +591,17 @@ __osm_sm_mad_ctrl_process_trap(
 
   p_smp = osm_madw_get_smp_ptr( p_madw );
 
+  /* Make sure OpenSM is master. If not - then we should not process the trap */
+  if (p_ctrl->p_subn->sm_state != IB_SMINFO_STATE_MASTER)
+  {
+    osm_log( p_ctrl->p_log, OSM_LOG_DEBUG,
+             "__osm_sm_mad_ctrl_process_trap: "
+             "Received trap but OpenSM is not in MASTER state. "
+             "Dropping mad. \n");
+    osm_mad_pool_put( p_ctrl->p_mad_pool, p_madw );
+    goto Exit;
+  }
+
   /*
     Note that attr_id (like the rest of the MAD) is in
     network byte order.
Index: opensm/osm_trap_rcv.c
===================================================================
--- opensm/osm_trap_rcv.c	(revision 435)
+++ opensm/osm_trap_rcv.c	(working copy)
@@ -375,6 +375,16 @@ __osm_trap_rcv_process_request(
 
     if (p_madw->mad_addr.addr_type.smi.source_lid == 0)
     {
+      /* Check if the sm_base_lid is 0. If yes - this means that
+         the local lid wasn't configured yet. Don't send a response
+         to the trap. */
+      if (p_rcv->p_subn->sm_base_lid == 0)
+      {
+        osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
+                 "__osm_trap_rcv_process_request: "
+                 "Received a SLID=0 Trap. local LID=0. Ignoring mad. \n");
+        goto Exit;
+      }
       osm_log( p_rcv->p_log, OSM_LOG_DEBUG,
                "__osm_trap_rcv_process_request: "
                "Received a SLID=0 Trap. Using local LID:0x%04X instead:.\n",




More information about the general mailing list