[openib-general] [PATCH 1/2] OpenSM/osm_sa_(path multipath_record).c: Handle off subnet GID requests better in preparation for IB router/multisubnet support
Hal Rosenstock
halr at voltaire.com
Tue Jan 2 09:01:25 PST 2007
OpenSM/osm_sa_(path multipath_record).c: Handle off subnet GID requests
better in preparation for IB router/multisubnet support
Signed-off-by: Hal Rosenstock <halr at voltaire.com>
diff --git a/osm/opensm/osm_sa_multipath_record.c b/osm/opensm/osm_sa_multipath_record.c
index 7070ec4..1d2d203 100644
--- a/osm/opensm/osm_sa_multipath_record.c
+++ b/osm/opensm/osm_sa_multipath_record.c
@@ -1198,6 +1198,7 @@ __osm_mpr_rcv_get_gids(
IN osm_mpr_rcv_t* const p_rcv,
IN const ib_gid_t * gids,
IN int ngids,
+ IN int is_sgid,
OUT osm_port_t** pp_port )
{
osm_port_t *p_port;
@@ -1207,6 +1208,25 @@ __osm_mpr_rcv_get_gids(
OSM_LOG_ENTER( p_rcv->p_log, __osm_mpr_rcv_get_gids );
for ( i = 0; i < ngids; i++, gids++ ) {
+ if ( !ib_gid_is_link_local ( gids ) ) {
+ if ( ( is_sgid && ib_gid_is_multicast( gids ) ) ||
+ ( ib_gid_get_subnet_prefix ( gids ) != p_rcv->p_subn->opt.subnet_prefix ) ) {
+ /*
+ This 'error' is the client's fault (bad gid) so
+ don't enter it as an error in our own log.
+ Return an error response to the client.
+ */
+ osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
+ "__osm_mpr_rcv_get_gids: ERR 451B: "
+ "Non local %sGID subnet prefix 0x%016" PRIx64 "\n",
+ is_sgid ? "S" : "D",
+ cl_ntoh64( gids->unicast.prefix ) );
+
+ ib_status = IB_SA_MAD_STATUS_INVALID_GID;
+ goto Exit;
+ }
+ }
+
p_port = (osm_port_t *)cl_qmap_get( &p_rcv->p_subn->port_guid_tbl,
gids->unicast.interface_id );
if ( !p_port ||
@@ -1266,16 +1286,13 @@ __osm_mpr_rcv_get_end_points(
Check a few easy disqualifying cases up front before getting
into the endpoints.
*/
-
- /* SDGIDs could be checked for multicast disqualification. */
-
*nsrc = *ndest = 0;
if ( comp_mask & IB_MPR_COMPMASK_SGIDCOUNT ) {
*nsrc = p_mpr->sgid_count;
if ( *nsrc > IB_MULTIPATH_MAX_GIDS )
*nsrc = IB_MULTIPATH_MAX_GIDS;
- sa_status = __osm_mpr_rcv_get_gids( p_rcv, gids, *nsrc, pp_ports );
+ sa_status = __osm_mpr_rcv_get_gids( p_rcv, gids, *nsrc, 1, pp_ports );
if ( sa_status != IB_SUCCESS )
goto Exit;
}
@@ -1284,7 +1301,7 @@ __osm_mpr_rcv_get_end_points(
*ndest = p_mpr->dgid_count;
if ( *ndest + *nsrc > IB_MULTIPATH_MAX_GIDS )
*ndest = IB_MULTIPATH_MAX_GIDS - *nsrc;
- sa_status = __osm_mpr_rcv_get_gids( p_rcv, gids + *nsrc, *ndest,
+ sa_status = __osm_mpr_rcv_get_gids( p_rcv, gids + *nsrc, *ndest, 0,
pp_ports + *nsrc );
}
diff --git a/osm/opensm/osm_sa_path_record.c b/osm/opensm/osm_sa_path_record.c
index e61d617..0500a74 100644
--- a/osm/opensm/osm_sa_path_record.c
+++ b/osm/opensm/osm_sa_path_record.c
@@ -1166,6 +1166,25 @@ __osm_pr_rcv_get_end_points(
if( comp_mask & IB_PR_COMPMASK_SGID )
{
+ if ( ! ib_gid_is_link_local ( &p_pr->sgid ) )
+ {
+ if ( ib_gid_get_subnet_prefix ( &p_pr->sgid ) != p_rcv->p_subn->opt.subnet_prefix )
+ {
+ /*
+ This 'error' is the client's fault (bad gid) so
+ don't enter it as an error in our own log.
+ Return an error response to the client.
+ */
+ osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
+ "__osm_pr_rcv_get_end_points: "
+ "Non local SGID subnet prefix 0x%016" PRIx64 "\n",
+ cl_ntoh64( p_pr->sgid.unicast.prefix ) );
+
+ sa_status = IB_SA_MAD_STATUS_INVALID_GID;
+ goto Exit;
+ }
+ }
+
*pp_src_port = (osm_port_t*)cl_qmap_get(
&p_rcv->p_subn->port_guid_tbl,
p_pr->sgid.unicast.interface_id );
@@ -1215,6 +1234,26 @@ __osm_pr_rcv_get_end_points(
if( comp_mask & IB_PR_COMPMASK_DGID )
{
+ if ( ! ib_gid_is_link_local ( &p_pr->dgid ) )
+ {
+ if ( ! ib_gid_is_multicast ( &p_pr->dgid ) &&
+ ib_gid_get_subnet_prefix ( &p_pr->dgid ) != p_rcv->p_subn->opt.subnet_prefix )
+ {
+ /*
+ This 'error' is the client's fault (bad gid) so
+ don't enter it as an error in our own log.
+ Return an error response to the client.
+ */
+ osm_log( p_rcv->p_log, OSM_LOG_VERBOSE,
+ "__osm_pr_rcv_get_end_points: "
+ "Non local DGID subnet prefix 0x%016" PRIx64 "\n",
+ cl_ntoh64( p_pr->dgid.unicast.prefix ) );
+
+ sa_status = IB_SA_MAD_STATUS_INVALID_GID;
+ goto Exit;
+ }
+ }
+
*pp_dest_port = (osm_port_t*)cl_qmap_get(
&p_rcv->p_subn->port_guid_tbl,
p_pr->dgid.unicast.interface_id );
More information about the general
mailing list