diff options
Diffstat (limited to 'net/tipc/discover.c')
| -rw-r--r-- | net/tipc/discover.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/net/tipc/discover.c b/net/tipc/discover.c index 412ff41b8611..542fe3413dc4 100644 --- a/net/tipc/discover.c +++ b/net/tipc/discover.c | |||
| @@ -48,7 +48,6 @@ | |||
| 48 | * struct tipc_link_req - information about an ongoing link setup request | 48 | * struct tipc_link_req - information about an ongoing link setup request |
| 49 | * @bearer: bearer issuing requests | 49 | * @bearer: bearer issuing requests |
| 50 | * @dest: destination address for request messages | 50 | * @dest: destination address for request messages |
| 51 | * @domain: network domain to which links can be established | ||
| 52 | * @num_nodes: number of nodes currently discovered (i.e. with an active link) | 51 | * @num_nodes: number of nodes currently discovered (i.e. with an active link) |
| 53 | * @lock: spinlock for controlling access to requests | 52 | * @lock: spinlock for controlling access to requests |
| 54 | * @buf: request message to be (repeatedly) sent | 53 | * @buf: request message to be (repeatedly) sent |
| @@ -58,7 +57,6 @@ | |||
| 58 | struct tipc_link_req { | 57 | struct tipc_link_req { |
| 59 | struct tipc_bearer *bearer; | 58 | struct tipc_bearer *bearer; |
| 60 | struct tipc_media_addr dest; | 59 | struct tipc_media_addr dest; |
| 61 | u32 domain; | ||
| 62 | int num_nodes; | 60 | int num_nodes; |
| 63 | spinlock_t lock; | 61 | spinlock_t lock; |
| 64 | struct sk_buff *buf; | 62 | struct sk_buff *buf; |
| @@ -69,14 +67,13 @@ struct tipc_link_req { | |||
| 69 | /** | 67 | /** |
| 70 | * tipc_disc_init_msg - initialize a link setup message | 68 | * tipc_disc_init_msg - initialize a link setup message |
| 71 | * @type: message type (request or response) | 69 | * @type: message type (request or response) |
| 72 | * @dest_domain: network domain of node(s) which should respond to message | ||
| 73 | * @b_ptr: ptr to bearer issuing message | 70 | * @b_ptr: ptr to bearer issuing message |
| 74 | */ | 71 | */ |
| 75 | static struct sk_buff *tipc_disc_init_msg(u32 type, u32 dest_domain, | 72 | static struct sk_buff *tipc_disc_init_msg(u32 type, struct tipc_bearer *b_ptr) |
| 76 | struct tipc_bearer *b_ptr) | ||
| 77 | { | 73 | { |
| 78 | struct sk_buff *buf = tipc_buf_acquire(INT_H_SIZE); | 74 | struct sk_buff *buf = tipc_buf_acquire(INT_H_SIZE); |
| 79 | struct tipc_msg *msg; | 75 | struct tipc_msg *msg; |
| 76 | u32 dest_domain = b_ptr->domain; | ||
| 80 | 77 | ||
| 81 | if (buf) { | 78 | if (buf) { |
| 82 | msg = buf_msg(buf); | 79 | msg = buf_msg(buf); |
| @@ -110,11 +107,11 @@ static void disc_dupl_alert(struct tipc_bearer *b_ptr, u32 node_addr, | |||
| 110 | } | 107 | } |
| 111 | 108 | ||
| 112 | /** | 109 | /** |
| 113 | * tipc_disc_recv_msg - handle incoming link setup message (request or response) | 110 | * tipc_disc_rcv - handle incoming link setup message (request or response) |
| 114 | * @buf: buffer containing message | 111 | * @buf: buffer containing message |
| 115 | * @b_ptr: bearer that message arrived on | 112 | * @b_ptr: bearer that message arrived on |
| 116 | */ | 113 | */ |
| 117 | void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr) | 114 | void tipc_disc_rcv(struct sk_buff *buf, struct tipc_bearer *b_ptr) |
| 118 | { | 115 | { |
| 119 | struct tipc_node *n_ptr; | 116 | struct tipc_node *n_ptr; |
| 120 | struct tipc_link *link; | 117 | struct tipc_link *link; |
| @@ -149,7 +146,7 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr) | |||
| 149 | } | 146 | } |
| 150 | if (!tipc_in_scope(dest, tipc_own_addr)) | 147 | if (!tipc_in_scope(dest, tipc_own_addr)) |
| 151 | return; | 148 | return; |
| 152 | if (!tipc_in_scope(b_ptr->link_req->domain, orig)) | 149 | if (!tipc_in_scope(b_ptr->domain, orig)) |
| 153 | return; | 150 | return; |
| 154 | 151 | ||
| 155 | /* Locate structure corresponding to requesting node */ | 152 | /* Locate structure corresponding to requesting node */ |
| @@ -242,7 +239,7 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr) | |||
| 242 | link_fully_up = link_working_working(link); | 239 | link_fully_up = link_working_working(link); |
| 243 | 240 | ||
| 244 | if ((type == DSC_REQ_MSG) && !link_fully_up) { | 241 | if ((type == DSC_REQ_MSG) && !link_fully_up) { |
| 245 | rbuf = tipc_disc_init_msg(DSC_RESP_MSG, orig, b_ptr); | 242 | rbuf = tipc_disc_init_msg(DSC_RESP_MSG, b_ptr); |
| 246 | if (rbuf) { | 243 | if (rbuf) { |
| 247 | tipc_bearer_send(b_ptr, rbuf, &media_addr); | 244 | tipc_bearer_send(b_ptr, rbuf, &media_addr); |
| 248 | kfree_skb(rbuf); | 245 | kfree_skb(rbuf); |
| @@ -306,7 +303,7 @@ static void disc_timeout(struct tipc_link_req *req) | |||
| 306 | spin_lock_bh(&req->lock); | 303 | spin_lock_bh(&req->lock); |
| 307 | 304 | ||
| 308 | /* Stop searching if only desired node has been found */ | 305 | /* Stop searching if only desired node has been found */ |
| 309 | if (tipc_node(req->domain) && req->num_nodes) { | 306 | if (tipc_node(req->bearer->domain) && req->num_nodes) { |
| 310 | req->timer_intv = TIPC_LINK_REQ_INACTIVE; | 307 | req->timer_intv = TIPC_LINK_REQ_INACTIVE; |
| 311 | goto exit; | 308 | goto exit; |
| 312 | } | 309 | } |
| @@ -342,8 +339,7 @@ exit: | |||
| 342 | * | 339 | * |
| 343 | * Returns 0 if successful, otherwise -errno. | 340 | * Returns 0 if successful, otherwise -errno. |
| 344 | */ | 341 | */ |
| 345 | int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest, | 342 | int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest) |
| 346 | u32 dest_domain) | ||
| 347 | { | 343 | { |
| 348 | struct tipc_link_req *req; | 344 | struct tipc_link_req *req; |
| 349 | 345 | ||
| @@ -351,7 +347,7 @@ int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest, | |||
| 351 | if (!req) | 347 | if (!req) |
| 352 | return -ENOMEM; | 348 | return -ENOMEM; |
| 353 | 349 | ||
| 354 | req->buf = tipc_disc_init_msg(DSC_REQ_MSG, dest_domain, b_ptr); | 350 | req->buf = tipc_disc_init_msg(DSC_REQ_MSG, b_ptr); |
| 355 | if (!req->buf) { | 351 | if (!req->buf) { |
| 356 | kfree(req); | 352 | kfree(req); |
| 357 | return -ENOMSG; | 353 | return -ENOMSG; |
| @@ -359,7 +355,6 @@ int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest, | |||
| 359 | 355 | ||
| 360 | memcpy(&req->dest, dest, sizeof(*dest)); | 356 | memcpy(&req->dest, dest, sizeof(*dest)); |
| 361 | req->bearer = b_ptr; | 357 | req->bearer = b_ptr; |
| 362 | req->domain = dest_domain; | ||
| 363 | req->num_nodes = 0; | 358 | req->num_nodes = 0; |
| 364 | req->timer_intv = TIPC_LINK_REQ_INIT; | 359 | req->timer_intv = TIPC_LINK_REQ_INIT; |
| 365 | spin_lock_init(&req->lock); | 360 | spin_lock_init(&req->lock); |
