From patchwork Sat Sep 19 17:00:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Khapyorsky X-Patchwork-Id: 48773 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8JGwQS3027316 for ; Sat, 19 Sep 2009 16:58:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751011AbZISQ6V (ORCPT ); Sat, 19 Sep 2009 12:58:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750984AbZISQ6V (ORCPT ); Sat, 19 Sep 2009 12:58:21 -0400 Received: from mail-ew0-f206.google.com ([209.85.219.206]:50762 "EHLO mail-ew0-f206.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750816AbZISQ6V (ORCPT ); Sat, 19 Sep 2009 12:58:21 -0400 Received: by ewy2 with SMTP id 2so2093778ewy.17 for ; Sat, 19 Sep 2009 09:58:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:received:date:from:to :cc:subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=Z0jL88HWpVfT4GuHBvv6OtMtgBBoKKEos+E73mEw7KM=; b=vCBBKT6Khal2p82UtO840Pcl4pxhTOvfdZ3DWBvv9hYg86WVkGiq49atrrsBtzAHQm FbDAmqkCKjQ57C83tCkjYsKtPI0OJXKzorL2x4S2u0RLVsImQDolPV0VhgT4CHewsyF5 Wfd1A/GqkfPIhowqGZjjWjcsFD54CXaMTl+20= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=Rqh5BP0QGP4HRhfjKP7qiSk2moIPQ2ZaYKPQTot3ziWfKPDFgcMbd9CviuUeFGaAuj DsVm9qLcTPB9PPcfotu8M05D8sTe4aOvfIsh194Bo7ctuJKFz7EpReNFKboMfb0bZjJC /azt2YaEfO0c360MDTNT7L9SvyBptWGSpLKLk= Received: by 10.211.161.16 with SMTP id n16mr3635052ebo.20.1253379503538; Sat, 19 Sep 2009 09:58:23 -0700 (PDT) Received: from me.localdomain (85.64.35.106.dynamic.barak-online.net [85.64.35.106]) by mx.google.com with ESMTPS id 5sm2681970eyh.35.2009.09.19.09.58.22 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 19 Sep 2009 09:58:23 -0700 (PDT) Received: by me.localdomain (Postfix, from userid 1000) id D7A5A417DC; Sat, 19 Sep 2009 20:00:00 +0300 (IDT) Date: Sat, 19 Sep 2009 20:00:00 +0300 From: Sasha Khapyorsky To: OpenIB , linux-rdma Cc: Eli Dorfman , Slava Strebkov , Hal Rosenstock Subject: [PATCH] opensm: discard multicast SA PR with wildcard DGID Message-ID: <20090919170000.GE13667@me> References: <20090919165817.GC13667@me> <20090919165924.GD13667@me> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20090919165924.GD13667@me> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org IBA 1.2.1 states (Vol.1, 15.2.5.16, p.918) that DGID shell be explicitly specified when path destination of SA PathRecord query is multicast group. Signed-off-by: Sasha Khapyorsky --- opensm/opensm/osm_sa_path_record.c | 45 ++++++++++++------------------------ 1 files changed, 15 insertions(+), 30 deletions(-) diff --git a/opensm/opensm/osm_sa_path_record.c b/opensm/opensm/osm_sa_path_record.c index f68be20..37f32ac 100644 --- a/opensm/opensm/osm_sa_path_record.c +++ b/opensm/opensm/osm_sa_path_record.c @@ -1437,45 +1437,27 @@ static osm_mgrp_t *pr_get_mgrp(IN osm_sa_t * sa, IN const osm_madw_t * p_madw) { ib_path_rec_t *p_pr; const ib_sa_mad_t *p_sa_mad; - ib_net64_t comp_mask; - osm_mgrp_t *mgrp = NULL; + osm_mgrp_t *mgrp; p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw); - p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad); + p_pr = ib_sa_mad_get_payload_ptr(p_sa_mad); - comp_mask = p_sa_mad->comp_mask; + if (!(p_sa_mad->comp_mask & IB_PR_COMPMASK_DGID)) { + OSM_LOG(sa->p_log, OSM_LOG_VERBOSE, + "discard multicast target SA PR with wildcarded MGID"); + return NULL; + } - if ((comp_mask & IB_PR_COMPMASK_DGID) && - !(mgrp = osm_get_mgrp_by_mgid(sa, &p_pr->dgid))) { + mgrp = osm_get_mgrp_by_mgid(sa, &p_pr->dgid); + if (!mgrp) { char gid_str[INET6_ADDRSTRLEN]; OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F09: " "No MC group found for PathRecord destination GID %s\n", inet_ntop(AF_INET6, p_pr->dgid.raw, gid_str, sizeof gid_str)); - goto Exit; - } - - if (comp_mask & IB_PR_COMPMASK_DLID) { - if (mgrp) { - /* check that the MLID in the MC group is */ - /* the same as the DLID in the PathRecord */ - if (mgrp->mlid != p_pr->dlid) { - /* Note: perhaps this might be better indicated as an invalid request */ - OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F10: " - "MC group MLID 0x%x does not match " - "PathRecord destination LID 0x%x\n", - mgrp->mlid, p_pr->dlid); - mgrp = NULL; - goto Exit; - } - } else - if (!(mgrp = osm_get_mgrp_by_mlid(sa->p_subn, p_pr->dlid))) - OSM_LOG(sa->p_log, OSM_LOG_ERROR, - "ERR 1F11: " "No MC group found for PathRecord " - "destination LID 0x%x\n", p_pr->dlid); + return NULL; } -Exit: return mgrp; } @@ -1497,10 +1479,14 @@ static ib_api_status_t pr_match_mgrp_attributes(IN osm_sa_t * sa, OSM_LOG_ENTER(sa->p_log); p_sa_mad = osm_madw_get_sa_mad_ptr(p_madw); - p_pr = (ib_path_rec_t *) ib_sa_mad_get_payload_ptr(p_sa_mad); + p_pr = ib_sa_mad_get_payload_ptr(p_sa_mad); comp_mask = p_sa_mad->comp_mask; + /* check that MLID of the MC group matchs the PathRecord DLID */ + if ((comp_mask & IB_PR_COMPMASK_DLID) && p_mgrp->mlid != p_pr->dlid) + goto Exit; + /* If SGID and/or SLID specified, should validate as member of MC group */ if (comp_mask & IB_PR_COMPMASK_SGID) { port = osm_get_port_by_guid(sa->p_subn, @@ -1713,7 +1699,6 @@ McastDest: /* First, get the MC info */ p_mgrp = pr_get_mgrp(sa, p_madw); - if (!p_mgrp) goto Unlock;