aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/node.c
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2006-12-12 18:13:32 -0500
committerDave Jones <davej@redhat.com>2006-12-12 18:13:32 -0500
commitf0eef25339f92f7cd4aeea23d9ae97987a5a1e82 (patch)
tree2472e94d39f43a9580a6d2d5d92de0b749023263 /net/tipc/node.c
parent0cfea5dd98205f2fa318836da664a7d7df1afbc1 (diff)
parente1036502e5263851259d147771226161e5ccc85a (diff)
Merge ../linus
Diffstat (limited to 'net/tipc/node.c')
-rw-r--r--net/tipc/node.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c
index fc6d09630ccd..4111a31def79 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -60,7 +60,7 @@ struct node *tipc_node_create(u32 addr)
60 struct node *n_ptr; 60 struct node *n_ptr;
61 struct node **curr_node; 61 struct node **curr_node;
62 62
63 n_ptr = kmalloc(sizeof(*n_ptr),GFP_ATOMIC); 63 n_ptr = kzalloc(sizeof(*n_ptr),GFP_ATOMIC);
64 if (!n_ptr) { 64 if (!n_ptr) {
65 warn("Node creation failed, no memory\n"); 65 warn("Node creation failed, no memory\n");
66 return NULL; 66 return NULL;
@@ -75,7 +75,6 @@ struct node *tipc_node_create(u32 addr)
75 return NULL; 75 return NULL;
76 } 76 }
77 77
78 memset(n_ptr, 0, sizeof(*n_ptr));
79 n_ptr->addr = addr; 78 n_ptr->addr = addr;
80 spin_lock_init(&n_ptr->lock); 79 spin_lock_init(&n_ptr->lock);
81 INIT_LIST_HEAD(&n_ptr->nsub); 80 INIT_LIST_HEAD(&n_ptr->nsub);
@@ -597,8 +596,7 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
597 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) 596 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
598 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 597 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
599 598
600 domain = *(u32 *)TLV_DATA(req_tlv_area); 599 domain = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
601 domain = ntohl(domain);
602 if (!tipc_addr_domain_valid(domain)) 600 if (!tipc_addr_domain_valid(domain))
603 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 601 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
604 " (network address)"); 602 " (network address)");
@@ -642,13 +640,12 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
642 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR)) 640 if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
643 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); 641 return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
644 642
645 domain = *(u32 *)TLV_DATA(req_tlv_area); 643 domain = ntohl(*(__be32 *)TLV_DATA(req_tlv_area));
646 domain = ntohl(domain);
647 if (!tipc_addr_domain_valid(domain)) 644 if (!tipc_addr_domain_valid(domain))
648 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE 645 return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
649 " (network address)"); 646 " (network address)");
650 647
651 if (!tipc_nodes) 648 if (tipc_mode != TIPC_NET_MODE)
652 return tipc_cfg_reply_none(); 649 return tipc_cfg_reply_none();
653 650
654 /* Get space for all unicast links + multicast link */ 651 /* Get space for all unicast links + multicast link */
@@ -664,8 +661,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
664 661
665 /* Add TLV for broadcast link */ 662 /* Add TLV for broadcast link */
666 663
667 link_info.dest = tipc_own_addr & 0xfffff00; 664 link_info.dest = htonl(tipc_own_addr & 0xfffff00);
668 link_info.dest = htonl(link_info.dest);
669 link_info.up = htonl(1); 665 link_info.up = htonl(1);
670 sprintf(link_info.str, tipc_bclink_name); 666 sprintf(link_info.str, tipc_bclink_name);
671 tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info)); 667 tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info));