All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
To: OpenIB
	<general-ZwoEplunGu1OwGhvXhtEPSCwEArCW2h5@public.gmane.org>,
	linux-rdma <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: Eli Dorfman <elid-smomgflXvOZWk0Htik3J/w@public.gmane.org>,
	Slava Strebkov <slavas-smomgflXvOZWk0Htik3J/w@public.gmane.org>,
	Hal Rosenstock
	<hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH] opensm/osm_sa_path_record.c: validate multicast membership
Date: Sat, 19 Sep 2009 19:59:24 +0300	[thread overview]
Message-ID: <20090919165924.GD13667@me> (raw)
In-Reply-To: <20090919165817.GC13667@me>


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 <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
 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)
-- 
1.6.5.rc1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2009-09-19 16:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-19 16:58 [PATCH] opensm/multicast: improve function prototypes Sasha Khapyorsky
2009-09-19 16:59 ` Sasha Khapyorsky [this message]
2009-09-19 17:00   ` [PATCH] opensm: discard multicast SA PR with wildcard DGID Sasha Khapyorsky
2009-09-19 17:00   ` [PATCH] opensm: osm_get_port_by_lid() helper Sasha Khapyorsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090919165924.GD13667@me \
    --to=sashak-smomgflxvozwk0htik3j/w@public.gmane.org \
    --cc=elid-smomgflXvOZWk0Htik3J/w@public.gmane.org \
    --cc=general-ZwoEplunGu1OwGhvXhtEPSCwEArCW2h5@public.gmane.org \
    --cc=hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=slavas-smomgflXvOZWk0Htik3J/w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.