From patchwork Sat Sep 19 16:59:24 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Khapyorsky X-Patchwork-Id: 48772 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 n8JGukCW027116 for ; Sat, 19 Sep 2009 16:57:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750736AbZISQ5p (ORCPT ); Sat, 19 Sep 2009 12:57:45 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750816AbZISQ5p (ORCPT ); Sat, 19 Sep 2009 12:57:45 -0400 Received: from mail-ew0-f206.google.com ([209.85.219.206]:65371 "EHLO mail-ew0-f206.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750736AbZISQ5o (ORCPT ); Sat, 19 Sep 2009 12:57:44 -0400 Received: by ewy2 with SMTP id 2so2093532ewy.17 for ; Sat, 19 Sep 2009 09:57:47 -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=vo9ghLidQly9WuVhaNYvAZ63W76gAx4dsCFBCfhLU/o=; b=UUpwcHMPqq8spmaEWWPbuob0i93NPHm/9mUUAWz0c0IAnjhm7mNiy9uXiiv4worTTP iqN3qTMrdmi8HUdkC+cDtNB3uZQjy7Qfvpfn1+BvM4AJlyiIxB924XBpj2pykQJrE+Mz YtF1jWnZk6EZv0GuoXpdfyVhpMEdr2Ws/PK78= 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=I9uzZYRDZrhBJQd6igRXYCIOLqEvl174AgROuB1LcWTBvD52p77X2olxlIO8JnDxGu aKPuPlnsEl2wfO6a9dOkujURwKgR5Ogrwbt5e3Dz4ZOfHtzKwdkTslBmIESqDjtplRDP BfAoKG/+9Q2Vp89oSeyZlUxbSxEBx/qVh19wk= Received: by 10.211.19.17 with SMTP id w17mr930073ebi.92.1253379467563; Sat, 19 Sep 2009 09:57:47 -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 28sm3826385eye.22.2009.09.19.09.57.46 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 19 Sep 2009 09:57:46 -0700 (PDT) Received: by me.localdomain (Postfix, from userid 1000) id 94A30417DC; Sat, 19 Sep 2009 19:59:24 +0300 (IDT) Date: Sat, 19 Sep 2009 19:59:24 +0300 From: Sasha Khapyorsky To: OpenIB , linux-rdma Cc: Eli Dorfman , Slava Strebkov , Hal Rosenstock Subject: [PATCH] opensm/osm_sa_path_record.c: validate multicast membership Message-ID: <20090919165924.GD13667@me> References: <20090919165817.GC13667@me> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20090919165817.GC13667@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 When PathRecord query has multicast destination and SLID and/or SGID is specified we need to ensure that this path source port is member of the destination multicast group. Signed-off-by: Sasha Khapyorsky --- opensm/opensm/osm_sa_path_record.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/opensm/opensm/osm_sa_path_record.c b/opensm/opensm/osm_sa_path_record.c index 75d9516..f68be20 100644 --- a/opensm/opensm/osm_sa_path_record.c +++ b/opensm/opensm/osm_sa_path_record.c @@ -1488,6 +1488,7 @@ static ib_api_status_t pr_match_mgrp_attributes(IN osm_sa_t * sa, const ib_path_rec_t *p_pr; const ib_sa_mad_t *p_sa_mad; ib_net64_t comp_mask; + const osm_port_t *port; ib_api_status_t status = IB_ERROR; uint32_t flow_label; uint8_t sl; @@ -1501,6 +1502,19 @@ static ib_api_status_t pr_match_mgrp_attributes(IN osm_sa_t * sa, comp_mask = p_sa_mad->comp_mask; /* 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, + p_pr->sgid.unicast.interface_id); + if (!port || !osm_mgrp_get_mcm_port(p_mgrp, port->guid)) + goto Exit; + } + + if (comp_mask & IB_PR_COMPMASK_SLID) { + if (osm_get_port_by_base_lid(sa->p_subn, p_pr->slid, &port) || + !port || !osm_mgrp_get_mcm_port(p_mgrp, port->guid)) + goto Exit; + } + /* Also, MTU, rate, packet lifetime, and raw traffic requested are not currently checked */ if (comp_mask & IB_PR_COMPMASK_PKEY) { if (p_pr->pkey != p_mgrp->mcmember_rec.pkey)