Skip to content

Commit fc0eea6

Browse files
ajstephensPaul Gortmaker
authored andcommitted
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>
1 parent 7c3a95a commit fc0eea6

4 files changed

Lines changed: 21 additions & 0 deletions

File tree

‎net/tipc/discover.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ static struct sk_buff *tipc_disc_init_msg(u32 type,
8282
msg = buf_msg(buf);
8383
tipc_msg_init(msg, LINK_CONFIG, type, INT_H_SIZE, dest_domain);
8484
msg_set_non_seq(msg, 1);
85+
msg_set_node_sig(msg, tipc_random);
8586
msg_set_dest_domain(msg, dest_domain);
8687
msg_set_bc_netid(msg, tipc_net_id);
8788
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)
128129
u32 orig = msg_prevnode(msg);
129130
u32 net_id = msg_bc_netid(msg);
130131
u32 type = msg_type(msg);
132+
u32 signature = msg_node_sig(msg);
131133
int link_fully_up;
132134

133135
media_addr.broadcast = 1;
@@ -197,6 +199,7 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr)
197199
}
198200

199201
/* Accept discovery message & send response, if necessary */
202+
n_ptr->signature = signature;
200203
link_fully_up = link_working_working(link);
201204

202205
if ((type == DSC_REQ_MSG) && !link_fully_up && !b_ptr->blocked) {

‎net/tipc/msg.h‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,16 @@ static inline void msg_set_seq_gap(struct tipc_msg *m, u32 n)
517517
msg_set_bits(m, 1, 16, 0x1fff, n);
518518
}
519519

520+
static inline u32 msg_node_sig(struct tipc_msg *m)
521+
{
522+
return msg_bits(m, 1, 0, 0xffff);
523+
}
524+
525+
static inline void msg_set_node_sig(struct tipc_msg *m, u32 n)
526+
{
527+
msg_set_bits(m, 1, 0, 0xffff, n);
528+
}
529+
520530

521531
/*
522532
* Word 2

‎net/tipc/node.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ struct tipc_node *tipc_node_create(u32 addr)
112112
}
113113
list_add_tail(&n_ptr->list, &temp_node->list);
114114
n_ptr->block_setup = WAIT_PEER_DOWN;
115+
n_ptr->signature = INVALID_NODE_SIG;
115116

116117
tipc_num_nodes++;
117118

‎net/tipc/node.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242
#include "net.h"
4343
#include "bearer.h"
4444

45+
/*
46+
* Out-of-range value for node signature
47+
*/
48+
#define INVALID_NODE_SIG 0x10000
49+
4550
/* Flags used to block (re)establishment of contact with a neighboring node */
4651

4752
#define WAIT_PEER_DOWN 0x0001 /* wait to see that peer's links are down */
@@ -61,6 +66,7 @@
6166
* @block_setup: bit mask of conditions preventing link establishment to node
6267
* @link_cnt: number of links to node
6368
* @permit_changeover: non-zero if node has redundant links to this system
69+
* @signature: node instance identifier
6470
* @bclink: broadcast-related info
6571
* @supportable: non-zero if node supports TIPC b'cast link capability
6672
* @supported: non-zero if node supports TIPC b'cast capability
@@ -86,6 +92,7 @@ struct tipc_node {
8692
int working_links;
8793
int block_setup;
8894
int permit_changeover;
95+
u32 signature;
8996
struct {
9097
u8 supportable;
9198
u8 supported;

0 commit comments

Comments
 (0)