netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Allan.Stephens@windriver.com,
	Paul Gortmaker <paul.gortmaker@windriver.com>
Subject: [PATCH net-next 14/21] tipc: Strengthen checks for neighboring node discovery
Date: Tue, 10 May 2011 16:44:30 -0400	[thread overview]
Message-ID: <1305060277-15600-15-git-send-email-paul.gortmaker@windriver.com> (raw)
In-Reply-To: <1305060277-15600-1-git-send-email-paul.gortmaker@windriver.com>

From: Allan Stephens <Allan.Stephens@windriver.com>

Enhances existing checks on the discovery domain associated with a TIPC
bearer. A bearer can no longer be configured to accept links from itself
only (which would be pointless), or to nodes outside its own cluster
(since multi-cluster support has now been removed from TIPC). Also, the
neighbor discovery routine now validates link setup requests against the
configured discovery domain for the bearer, rather than simply ensuring
the requesting node belongs to the node's own cluster.

Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 net/tipc/bearer.c   |   11 +++++++++--
 net/tipc/discover.c |    7 +++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 411719f..f7c29af 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -493,8 +493,15 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
 		warn("Bearer <%s> rejected, illegal name\n", name);
 		return -EINVAL;
 	}
-	if (!tipc_addr_domain_valid(disc_domain) ||
-	    !tipc_in_scope(disc_domain, tipc_own_addr)) {
+	if (tipc_addr_domain_valid(disc_domain) &&
+	    (disc_domain != tipc_own_addr)) {
+		if (tipc_in_scope(disc_domain, tipc_own_addr)) {
+			disc_domain = tipc_own_addr & TIPC_CLUSTER_MASK;
+			res = 0;   /* accept any node in own cluster */
+		} else if (in_own_cluster(disc_domain))
+			res = 0;   /* accept specified node in own cluster */
+	}
+	if (res) {
 		warn("Bearer <%s> rejected, illegal discovery domain\n", name);
 		return -EINVAL;
 	}
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index 491eff5..d2163bd 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -52,6 +52,7 @@
  * struct link_req - information about an ongoing link setup request
  * @bearer: bearer issuing requests
  * @dest: destination address for request messages
+ * @domain: network domain to which links can be established
  * @buf: request message to be (repeatedly) sent
  * @timer: timer governing period between requests
  * @timer_intv: current interval between requests (in ms)
@@ -59,6 +60,7 @@
 struct link_req {
 	struct tipc_bearer *bearer;
 	struct tipc_media_addr dest;
+	u32 domain;
 	struct sk_buff *buf;
 	struct timer_list timer;
 	unsigned int timer_intv;
@@ -147,7 +149,7 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr)
 	}
 	if (!tipc_in_scope(dest, tipc_own_addr))
 		return;
-	if (!in_own_cluster(orig))
+	if (!tipc_in_scope(b_ptr->link_req->domain, orig))
 		return;
 
 	/* Locate structure corresponding to requesting node */
@@ -287,7 +289,7 @@ static void disc_timeout(struct link_req *req)
  * tipc_disc_init_link_req - start sending periodic link setup requests
  * @b_ptr: ptr to bearer issuing requests
  * @dest: destination address for request messages
- * @dest_domain: network domain of node(s) which should respond to message
+ * @dest_domain: network domain to which links can be established
  *
  * Returns pointer to link request structure, or NULL if unable to create.
  */
@@ -310,6 +312,7 @@ struct link_req *tipc_disc_init_link_req(struct tipc_bearer *b_ptr,
 
 	memcpy(&req->dest, dest, sizeof(*dest));
 	req->bearer = b_ptr;
+	req->domain = dest_domain;
 	req->timer_intv = TIPC_LINK_REQ_INIT;
 	k_init_timer(&req->timer, (Handler)disc_timeout, (unsigned long)req);
 	k_start_timer(&req->timer, req->timer_intv);
-- 
1.7.4.4


  parent reply	other threads:[~2011-05-10 20:45 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-10 20:44 [PATCH net-next 00/21] tipc updates for the next round Paul Gortmaker
2011-05-10 20:44 ` [PATCH net-next 01/21] tipc: Drop __TIME__ usage Paul Gortmaker
2011-05-10 20:44 ` [PATCH net-next 02/21] tipc: Update comments in message header include file Paul Gortmaker
2011-05-10 20:44 ` [PATCH net-next 03/21] tipc: Eliminate unused routing message definitions Paul Gortmaker
2011-05-10 20:44 ` [PATCH net-next 04/21] tipc: Cosmetic consolidation of internal message type definitions Paul Gortmaker
2011-05-10 20:44 ` [PATCH net-next 05/21] tipc: Remove code to emulate loss of broadcast messages Paul Gortmaker
2011-05-10 20:44 ` [PATCH net-next 06/21] tipc: Don't initialize link selector field in fragmented messages Paul Gortmaker
2011-05-10 20:44 ` [PATCH net-next 07/21] tipc: Avoid pointless masking of fragmented message identifier Paul Gortmaker
2011-05-10 20:44 ` [PATCH net-next 08/21] tipc: Fix issues with fragmentation of an existing message buffer Paul Gortmaker
2011-05-10 20:44 ` [PATCH net-next 09/21] tipc: Set name lookup scope field properly in all data messages Paul Gortmaker
2011-05-10 20:44 ` [PATCH net-next 10/21] tipc: Fix problem with bundled multicast message Paul Gortmaker
2011-05-10 20:44 ` [PATCH net-next 11/21] tipc: Update destination node field on incoming multicast messages Paul Gortmaker
2011-05-10 20:44 ` [PATCH net-next 12/21] tipc: Fix sk_buff leaks when link congestion is detected Paul Gortmaker
2011-05-10 20:44 ` [PATCH net-next 13/21] tipc: make zone/cluster mask constants a define Paul Gortmaker
2011-05-10 20:44 ` Paul Gortmaker [this message]
2011-05-10 20:44 ` [PATCH net-next 15/21] tipc: Abort excessive send requests as early as possible Paul Gortmaker
2011-05-10 20:44 ` [PATCH net-next 16/21] tipc: Avoid recomputation of outgoing message length Paul Gortmaker
2011-05-10 20:44 ` [PATCH net-next 17/21] tipc: Introduce routine to enqueue a chain of messages on link tx queue Paul Gortmaker
2011-05-10 20:44 ` [PATCH net-next 18/21] tipc: Enhance handling of discovery object creation failures Paul Gortmaker
2011-05-10 20:44 ` [PATCH net-next 19/21] tipc: Enhance sending of discovery object link request messages Paul Gortmaker
2011-05-10 20:44 ` [PATCH net-next 20/21] tipc: Add monitoring of number of nodes discovered by bearer Paul Gortmaker
2011-05-10 20:44 ` [PATCH net-next 21/21] tipc: Revise timings used when sending link request messages Paul Gortmaker
2011-05-11 18:01 ` [PATCH net-next 00/21] tipc updates for the next round David Miller
2011-05-11 18:02   ` Stephens, Allan

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=1305060277-15600-15-git-send-email-paul.gortmaker@windriver.com \
    --to=paul.gortmaker@windriver.com \
    --cc=Allan.Stephens@windriver.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).