aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/config.c')
-rw-r--r--net/tipc/config.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/net/tipc/config.c b/net/tipc/config.c
index f76d3b15e4e2..c5712a343810 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -131,7 +131,6 @@ static struct sk_buff *tipc_show_stats(void)
131 tipc_printf(&pb, "TIPC version " TIPC_MOD_VER "\n"); 131 tipc_printf(&pb, "TIPC version " TIPC_MOD_VER "\n");
132 132
133 /* Use additional tipc_printf()'s to return more info ... */ 133 /* Use additional tipc_printf()'s to return more info ... */
134
135 str_len = tipc_printbuf_validate(&pb); 134 str_len = tipc_printbuf_validate(&pb);
136 skb_put(buf, TLV_SPACE(str_len)); 135 skb_put(buf, TLV_SPACE(str_len));
137 TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len); 136 TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len);
@@ -191,7 +190,6 @@ static struct sk_buff *cfg_set_own_addr(void)
191 * configuration commands can't be received until a local configuration 190 * configuration commands can't be received until a local configuration
192 * command to enable the first bearer is received and processed. 191 * command to enable the first bearer is received and processed.
193 */ 192 */
194
195 spin_unlock_bh(&config_lock); 193 spin_unlock_bh(&config_lock);
196 tipc_core_start_net(addr); 194 tipc_core_start_net(addr);
197 spin_lock_bh(&config_lock); 195 spin_lock_bh(&config_lock);
@@ -283,14 +281,12 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
283 spin_lock_bh(&config_lock); 281 spin_lock_bh(&config_lock);
284 282
285 /* Save request and reply details in a well-known location */ 283 /* Save request and reply details in a well-known location */
286
287 req_tlv_area = request_area; 284 req_tlv_area = request_area;
288 req_tlv_space = request_space; 285 req_tlv_space = request_space;
289 rep_headroom = reply_headroom; 286 rep_headroom = reply_headroom;
290 287
291 /* Check command authorization */ 288 /* Check command authorization */
292 289 if (likely(in_own_node(orig_node))) {
293 if (likely(orig_node == tipc_own_addr)) {
294 /* command is permitted */ 290 /* command is permitted */
295 } else if (cmd >= 0x8000) { 291 } else if (cmd >= 0x8000) {
296 rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED 292 rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
@@ -310,7 +306,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_area
310 } 306 }
311 307
312 /* Call appropriate processing routine */ 308 /* Call appropriate processing routine */
313
314 switch (cmd) { 309 switch (cmd) {
315 case TIPC_CMD_NOOP: 310 case TIPC_CMD_NOOP:
316 rep_tlv_buf = tipc_cfg_reply_none(); 311 rep_tlv_buf = tipc_cfg_reply_none();
@@ -433,7 +428,6 @@ static void cfg_named_msg_event(void *userdata,
433 struct sk_buff *rep_buf; 428 struct sk_buff *rep_buf;
434 429
435 /* Validate configuration message header (ignore invalid message) */ 430 /* Validate configuration message header (ignore invalid message) */
436
437 req_hdr = (struct tipc_cfg_msg_hdr *)msg; 431 req_hdr = (struct tipc_cfg_msg_hdr *)msg;
438 if ((size < sizeof(*req_hdr)) || 432 if ((size < sizeof(*req_hdr)) ||
439 (size != TCM_ALIGN(ntohl(req_hdr->tcm_len))) || 433 (size != TCM_ALIGN(ntohl(req_hdr->tcm_len))) ||
@@ -443,7 +437,6 @@ static void cfg_named_msg_event(void *userdata,
443 } 437 }
444 438
445 /* Generate reply for request (if can't, return request) */ 439 /* Generate reply for request (if can't, return request) */
446
447 rep_buf = tipc_cfg_do_cmd(orig->node, 440 rep_buf = tipc_cfg_do_cmd(orig->node,
448 ntohs(req_hdr->tcm_type), 441 ntohs(req_hdr->tcm_type),
449 msg + sizeof(*req_hdr), 442 msg + sizeof(*req_hdr),
@@ -489,10 +482,23 @@ failed:
489 return res; 482 return res;
490} 483}
491 484
485void tipc_cfg_reinit(void)
486{
487 struct tipc_name_seq seq;
488 int res;
489
490 seq.type = TIPC_CFG_SRV;
491 seq.lower = seq.upper = 0;
492 tipc_withdraw(config_port_ref, TIPC_ZONE_SCOPE, &seq);
493
494 seq.lower = seq.upper = tipc_own_addr;
495 res = tipc_publish(config_port_ref, TIPC_ZONE_SCOPE, &seq);
496 if (res)
497 err("Unable to reinitialize configuration service\n");
498}
499
492void tipc_cfg_stop(void) 500void tipc_cfg_stop(void)
493{ 501{
494 if (config_port_ref) { 502 tipc_deleteport(config_port_ref);
495 tipc_deleteport(config_port_ref); 503 config_port_ref = 0;
496 config_port_ref = 0;
497 }
498} 504}