]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
tipc: Introduce node signature field in neighbor discovery message
authorAllan Stephens <allan.stephens@windriver.com>
Fri, 28 Oct 2011 20:26:41 +0000 (16:26 -0400)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Fri, 24 Feb 2012 22:05:13 +0000 (17:05 -0500)
Adds support for the new "node signature" in neighbor discovery messages,
which is a 16 bit identifier chosen randomly when TIPC is initialized.
This field makes it possible for nodes receiving a neighbor discovery
message to detect if multiple neighboring nodes are using the same network
address (i.e. <Z.C.N>), even when the messages are arriving on different
interfaces.

This first phase of node signature support creates the signature,
incorporates it into outgoing neighbor discovery messages, and tracks
the signature used by valid neighbors. An upcoming patch builds on this
foundation to implement the improved duplicate neighbor detection checking.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
net/tipc/discover.c
net/tipc/msg.h
net/tipc/node.c
net/tipc/node.h

index a00e5f811569fd268ab3ffaed4cbd7824d5c1d71..7ae1b4c33aeb177b68fd52cd6de290f6136668ec 100644 (file)
@@ -82,6 +82,7 @@ static struct sk_buff *tipc_disc_init_msg(u32 type,
                msg = buf_msg(buf);
                tipc_msg_init(msg, LINK_CONFIG, type, INT_H_SIZE, dest_domain);
                msg_set_non_seq(msg, 1);
+               msg_set_node_sig(msg, tipc_random);
                msg_set_dest_domain(msg, dest_domain);
                msg_set_bc_netid(msg, tipc_net_id);
                b_ptr->media->addr2msg(&b_ptr->addr, msg_media_addr(msg));
@@ -128,6 +129,7 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr)
        u32 orig = msg_prevnode(msg);
        u32 net_id = msg_bc_netid(msg);
        u32 type = msg_type(msg);
+       u32 signature = msg_node_sig(msg);
        int link_fully_up;
 
        media_addr.broadcast = 1;
@@ -197,6 +199,7 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr)
        }
 
        /* Accept discovery message & send response, if necessary */
+       n_ptr->signature = signature;
        link_fully_up = link_working_working(link);
 
        if ((type == DSC_REQ_MSG) && !link_fully_up && !b_ptr->blocked) {
index 7b0cda1671072088a9c97af7b5b8aa402c0540d7..2ec13b73181173d15aa65cde5c6259b11ebc2cc4 100644 (file)
@@ -517,6 +517,16 @@ static inline void msg_set_seq_gap(struct tipc_msg *m, u32 n)
        msg_set_bits(m, 1, 16, 0x1fff, n);
 }
 
+static inline u32 msg_node_sig(struct tipc_msg *m)
+{
+       return msg_bits(m, 1, 0, 0xffff);
+}
+
+static inline void msg_set_node_sig(struct tipc_msg *m, u32 n)
+{
+       msg_set_bits(m, 1, 0, 0xffff, n);
+}
+
 
 /*
  * Word 2
index 7bc45e135fb4399b637db440abb84dc8fb504ce3..153425997cced306df3a7a77699b7fa97c87a4fb 100644 (file)
@@ -112,6 +112,7 @@ struct tipc_node *tipc_node_create(u32 addr)
        }
        list_add_tail(&n_ptr->list, &temp_node->list);
        n_ptr->block_setup = WAIT_PEER_DOWN;
+       n_ptr->signature = INVALID_NODE_SIG;
 
        tipc_num_nodes++;
 
index e1b78a2199c2e14daa4f9a106513d269ef735e76..7bf526af1dfb6914e4ecccb8454e673d2208d5cf 100644 (file)
 #include "net.h"
 #include "bearer.h"
 
+/*
+ * Out-of-range value for node signature
+ */
+#define INVALID_NODE_SIG 0x10000
+
 /* Flags used to block (re)establishment of contact with a neighboring node */
 
 #define WAIT_PEER_DOWN 0x0001  /* wait to see that peer's links are down */
@@ -61,6 +66,7 @@
  * @block_setup: bit mask of conditions preventing link establishment to node
  * @link_cnt: number of links to node
  * @permit_changeover: non-zero if node has redundant links to this system
+ * @signature: node instance identifier
  * @bclink: broadcast-related info
  *    @supportable: non-zero if node supports TIPC b'cast link capability
  *    @supported: non-zero if node supports TIPC b'cast capability
@@ -86,6 +92,7 @@ struct tipc_node {
        int working_links;
        int block_setup;
        int permit_changeover;
+       u32 signature;
        struct {
                u8 supportable;
                u8 supported;