summaryrefslogtreecommitdiffstats
path: root/net/tipc/discover.c
diff options
context:
space:
mode:
authorJon Paul Maloy <jon.maloy@ericsson.com>2015-07-16 16:54:20 -0400
committerDavid S. Miller <davem@davemloft.net>2015-07-20 23:41:14 -0400
commitd3a43b907ae688af6cb753c53cd7de05f3c1ba85 (patch)
treeb21793fdb903042e7fa094856ae477cf7928090b /net/tipc/discover.c
parent9d13ec65ede775f896c3da1cfa35283afe2f796c (diff)
tipc: move link creation from neighbor discoverer to node
As a step towards turning links into node internal entities, we move the creation of links from the neighbor discovery logics to the node's link control logics. We also create an additional entry for the link's media address in the newly introduced struct tipc_link_entry, since this is where it is needed in the upcoming commits. The current copy in struct tipc_link is kept for now, but will be removed later. Reviewed-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/discover.c')
-rw-r--r--net/tipc/discover.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index 933445337fb4..164d08907d6f 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "core.h" 37#include "core.h"
38#include "link.h" 38#include "node.h"
39#include "discover.h" 39#include "discover.h"
40 40
41/* min delay during bearer start up */ 41/* min delay during bearer start up */
@@ -125,7 +125,6 @@ void tipc_disc_rcv(struct net *net, struct sk_buff *buf,
125{ 125{
126 struct tipc_net *tn = net_generic(net, tipc_net_id); 126 struct tipc_net *tn = net_generic(net, tipc_net_id);
127 struct tipc_node *node; 127 struct tipc_node *node;
128 struct tipc_link *link;
129 struct tipc_media_addr maddr; 128 struct tipc_media_addr maddr;
130 struct sk_buff *rbuf; 129 struct sk_buff *rbuf;
131 struct tipc_msg *msg = buf_msg(buf); 130 struct tipc_msg *msg = buf_msg(buf);
@@ -170,13 +169,10 @@ void tipc_disc_rcv(struct net *net, struct sk_buff *buf,
170 return; 169 return;
171 tipc_node_lock(node); 170 tipc_node_lock(node);
172 node->capabilities = caps; 171 node->capabilities = caps;
173 link = node->links[bearer->identity].link;
174 172
175 /* Prepare to validate requesting node's signature and media address */ 173 /* Prepare to validate requesting node's signature and media address */
176 sign_match = (signature == node->signature); 174 sign_match = (signature == node->signature);
177 addr_match = link && !memcmp(&link->media_addr, &maddr, sizeof(maddr)); 175 tipc_node_check_dest(node, bearer, &link_up, &addr_match, &maddr);
178 link_up = link && tipc_link_is_up(link);
179
180 176
181 /* These three flags give us eight permutations: */ 177 /* These three flags give us eight permutations: */
182 178
@@ -239,16 +235,8 @@ void tipc_disc_rcv(struct net *net, struct sk_buff *buf,
239 if (accept_sign) 235 if (accept_sign)
240 node->signature = signature; 236 node->signature = signature;
241 237
242 if (accept_addr) { 238 if (accept_addr && !tipc_node_update_dest(node, bearer, &maddr))
243 if (!link) 239 respond = false;
244 link = tipc_link_create(node, bearer, &maddr);
245 if (link) {
246 memcpy(&link->media_addr, &maddr, sizeof(maddr));
247 tipc_link_reset(link);
248 } else {
249 respond = false;
250 }
251 }
252 240
253 /* Send response, if necessary */ 241 /* Send response, if necessary */
254 if (respond && (mtyp == DSC_REQ_MSG)) { 242 if (respond && (mtyp == DSC_REQ_MSG)) {