aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2011-10-28 16:26:41 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2012-02-24 17:05:13 -0500
commitfc0eea691a06ba8516795fb7a198239fb9db1cfc (patch)
treedfdcf4a88224cb919cc95641788b5eba58d0bd10 /net/tipc
parent7c3a95a15ad2a5278498a72df0463131048926a3 (diff)
tipc: Introduce node signature field in neighbor discovery message
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>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/discover.c3
-rw-r--r--net/tipc/msg.h10
-rw-r--r--net/tipc/node.c1
-rw-r--r--net/tipc/node.h7
4 files changed, 21 insertions, 0 deletions
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index a00e5f811569..7ae1b4c33aeb 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -82,6 +82,7 @@ static struct sk_buff *tipc_disc_init_msg(u32 type,
82 msg = buf_msg(buf); 82 msg = buf_msg(buf);
83 tipc_msg_init(msg, LINK_CONFIG, type, INT_H_SIZE, dest_domain); 83 tipc_msg_init(msg, LINK_CONFIG, type, INT_H_SIZE, dest_domain);
84 msg_set_non_seq(msg, 1); 84 msg_set_non_seq(msg, 1);
85 msg_set_node_sig(msg, tipc_random);
85 msg_set_dest_domain(msg, dest_domain); 86 msg_set_dest_domain(msg, dest_domain);
86 msg_set_bc_netid(msg, tipc_net_id); 87 msg_set_bc_netid(msg, tipc_net_id);
87 b_ptr->media->addr2msg(&b_ptr->addr, msg_media_addr(msg)); 88 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)
128 u32 orig = msg_prevnode(msg); 129 u32 orig = msg_prevnode(msg);
129 u32 net_id = msg_bc_netid(msg); 130 u32 net_id = msg_bc_netid(msg);
130 u32 type = msg_type(msg); 131 u32 type = msg_type(msg);
132 u32 signature = msg_node_sig(msg);
131 int link_fully_up; 133 int link_fully_up;
132 134
133 media_addr.broadcast = 1; 135 media_addr.broadcast = 1;
@@ -197,6 +199,7 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr)
197 } 199 }
198 200
199 /* Accept discovery message & send response, if necessary */ 201 /* Accept discovery message & send response, if necessary */
202 n_ptr->signature = signature;
200 link_fully_up = link_working_working(link); 203 link_fully_up = link_working_working(link);
201 204
202 if ((type == DSC_REQ_MSG) && !link_fully_up && !b_ptr->blocked) { 205 if ((type == DSC_REQ_MSG) && !link_fully_up && !b_ptr->blocked) {
diff --git a/net/tipc/msg.h b/net/tipc/msg.h
index 7b0cda167107..2ec13b731811 100644
--- a/net/tipc/msg.h
+++ b/net/tipc/msg.h
@@ -517,6 +517,16 @@ static inline void msg_set_seq_gap(struct tipc_msg *m, u32 n)
517 msg_set_bits(m, 1, 16, 0x1fff, n); 517 msg_set_bits(m, 1, 16, 0x1fff, n);
518} 518}
519 519
520static inline u32 msg_node_sig(struct tipc_msg *m)
521{
522 return msg_bits(m, 1, 0, 0xffff);
523}
524
525static inline void msg_set_node_sig(struct tipc_msg *m, u32 n)
526{
527 msg_set_bits(m, 1, 0, 0xffff, n);
528}
529
520 530
521/* 531/*
522 * Word 2 532 * Word 2
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 7bc45e135fb4..153425997cce 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -112,6 +112,7 @@ struct tipc_node *tipc_node_create(u32 addr)
112 } 112 }
113 list_add_tail(&n_ptr->list, &temp_node->list); 113 list_add_tail(&n_ptr->list, &temp_node->list);
114 n_ptr->block_setup = WAIT_PEER_DOWN; 114 n_ptr->block_setup = WAIT_PEER_DOWN;
115 n_ptr->signature = INVALID_NODE_SIG;
115 116
116 tipc_num_nodes++; 117 tipc_num_nodes++;
117 118
diff --git a/net/tipc/node.h b/net/tipc/node.h
index e1b78a2199c2..7bf526af1dfb 100644
--- a/net/tipc/node.h
+++ b/net/tipc/node.h
@@ -42,6 +42,11 @@
42#include "net.h" 42#include "net.h"
43#include "bearer.h" 43#include "bearer.h"
44 44
45/*
46 * Out-of-range value for node signature
47 */
48#define INVALID_NODE_SIG 0x10000
49
45/* Flags used to block (re)establishment of contact with a neighboring node */ 50/* Flags used to block (re)establishment of contact with a neighboring node */
46 51
47#define WAIT_PEER_DOWN 0x0001 /* wait to see that peer's links are down */ 52#define WAIT_PEER_DOWN 0x0001 /* wait to see that peer's links are down */
@@ -61,6 +66,7 @@
61 * @block_setup: bit mask of conditions preventing link establishment to node 66 * @block_setup: bit mask of conditions preventing link establishment to node
62 * @link_cnt: number of links to node 67 * @link_cnt: number of links to node
63 * @permit_changeover: non-zero if node has redundant links to this system 68 * @permit_changeover: non-zero if node has redundant links to this system
69 * @signature: node instance identifier
64 * @bclink: broadcast-related info 70 * @bclink: broadcast-related info
65 * @supportable: non-zero if node supports TIPC b'cast link capability 71 * @supportable: non-zero if node supports TIPC b'cast link capability
66 * @supported: non-zero if node supports TIPC b'cast capability 72 * @supported: non-zero if node supports TIPC b'cast capability
@@ -86,6 +92,7 @@ struct tipc_node {
86 int working_links; 92 int working_links;
87 int block_setup; 93 int block_setup;
88 int permit_changeover; 94 int permit_changeover;
95 u32 signature;
89 struct { 96 struct {
90 u8 supportable; 97 u8 supportable;
91 u8 supported; 98 u8 supported;