Commit a10bd924 authored by Allan Stephens's avatar Allan Stephens Committed by David S. Miller

[TIPC]: Enhanced & cleaned up system messages; fixed 2 obscure memory leaks.

Signed-off-by: default avatarAllan Stephens <allan.stephens@windriver.com>
Signed-off-by: default avatarPer Liden <per.liden@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f131072c
...@@ -785,7 +785,7 @@ int tipc_bclink_init(void) ...@@ -785,7 +785,7 @@ int tipc_bclink_init(void)
bclink = kmalloc(sizeof(*bclink), GFP_ATOMIC); bclink = kmalloc(sizeof(*bclink), GFP_ATOMIC);
if (!bcbearer || !bclink) { if (!bcbearer || !bclink) {
nomem: nomem:
warn("Memory squeeze; Failed to create multicast link\n"); warn("Multicast link creation failed, no memory\n");
kfree(bcbearer); kfree(bcbearer);
bcbearer = NULL; bcbearer = NULL;
kfree(bclink); kfree(bclink);
......
...@@ -180,7 +180,7 @@ static inline void tipc_port_list_add(struct port_list *pl_ptr, u32 port) ...@@ -180,7 +180,7 @@ static inline void tipc_port_list_add(struct port_list *pl_ptr, u32 port)
if (!item->next) { if (!item->next) {
item->next = kmalloc(sizeof(*item), GFP_ATOMIC); item->next = kmalloc(sizeof(*item), GFP_ATOMIC);
if (!item->next) { if (!item->next) {
warn("Memory squeeze: multicast destination port list is incomplete\n"); warn("Incomplete multicast delivery, no memory\n");
return; return;
} }
item->next->next = NULL; item->next->next = NULL;
......
...@@ -112,39 +112,42 @@ int tipc_register_media(u32 media_type, ...@@ -112,39 +112,42 @@ int tipc_register_media(u32 media_type,
goto exit; goto exit;
if (!media_name_valid(name)) { if (!media_name_valid(name)) {
warn("Media registration error: illegal name <%s>\n", name); warn("Media <%s> rejected, illegal name\n", name);
goto exit; goto exit;
} }
if (!bcast_addr) { if (!bcast_addr) {
warn("Media registration error: no broadcast address supplied\n"); warn("Media <%s> rejected, no broadcast address\n", name);
goto exit; goto exit;
} }
if ((bearer_priority < TIPC_MIN_LINK_PRI) && if ((bearer_priority < TIPC_MIN_LINK_PRI) &&
(bearer_priority > TIPC_MAX_LINK_PRI)) { (bearer_priority > TIPC_MAX_LINK_PRI)) {
warn("Media registration error: priority %u\n", bearer_priority); warn("Media <%s> rejected, illegal priority (%u)\n", name,
bearer_priority);
goto exit; goto exit;
} }
if ((link_tolerance < TIPC_MIN_LINK_TOL) || if ((link_tolerance < TIPC_MIN_LINK_TOL) ||
(link_tolerance > TIPC_MAX_LINK_TOL)) { (link_tolerance > TIPC_MAX_LINK_TOL)) {
warn("Media registration error: tolerance %u\n", link_tolerance); warn("Media <%s> rejected, illegal tolerance (%u)\n", name,
link_tolerance);
goto exit; goto exit;
} }
media_id = media_count++; media_id = media_count++;
if (media_id >= MAX_MEDIA) { if (media_id >= MAX_MEDIA) {
warn("Attempt to register more than %u media\n", MAX_MEDIA); warn("Media <%s> rejected, media limit reached (%u)\n", name,
MAX_MEDIA);
media_count--; media_count--;
goto exit; goto exit;
} }
for (i = 0; i < media_id; i++) { for (i = 0; i < media_id; i++) {
if (media_list[i].type_id == media_type) { if (media_list[i].type_id == media_type) {
warn("Attempt to register second media with type %u\n", warn("Media <%s> rejected, duplicate type (%u)\n", name,
media_type); media_type);
media_count--; media_count--;
goto exit; goto exit;
} }
if (!strcmp(name, media_list[i].name)) { if (!strcmp(name, media_list[i].name)) {
warn("Attempt to re-register media name <%s>\n", name); warn("Media <%s> rejected, duplicate name\n", name);
media_count--; media_count--;
goto exit; goto exit;
} }
...@@ -283,6 +286,9 @@ static struct bearer *bearer_find(const char *name) ...@@ -283,6 +286,9 @@ static struct bearer *bearer_find(const char *name)
struct bearer *b_ptr; struct bearer *b_ptr;
u32 i; u32 i;
if (tipc_mode != TIPC_NET_MODE)
return NULL;
for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) { for (i = 0, b_ptr = tipc_bearers; i < MAX_BEARERS; i++, b_ptr++) {
if (b_ptr->active && (!strcmp(b_ptr->publ.name, name))) if (b_ptr->active && (!strcmp(b_ptr->publ.name, name)))
return b_ptr; return b_ptr;
...@@ -475,26 +481,33 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) ...@@ -475,26 +481,33 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority)
u32 i; u32 i;
int res = -EINVAL; int res = -EINVAL;
if (tipc_mode != TIPC_NET_MODE) if (tipc_mode != TIPC_NET_MODE) {
warn("Bearer <%s> rejected, not supported in standalone mode\n",
name);
return -ENOPROTOOPT; return -ENOPROTOOPT;
}
if (!bearer_name_validate(name, &b_name) || if (!bearer_name_validate(name, &b_name)) {
!tipc_addr_domain_valid(bcast_scope) || warn("Bearer <%s> rejected, illegal name\n", name);
!in_scope(bcast_scope, tipc_own_addr))
return -EINVAL; return -EINVAL;
}
if (!tipc_addr_domain_valid(bcast_scope) ||
!in_scope(bcast_scope, tipc_own_addr)) {
warn("Bearer <%s> rejected, illegal broadcast scope\n", name);
return -EINVAL;
}
if ((priority < TIPC_MIN_LINK_PRI || if ((priority < TIPC_MIN_LINK_PRI ||
priority > TIPC_MAX_LINK_PRI) && priority > TIPC_MAX_LINK_PRI) &&
(priority != TIPC_MEDIA_LINK_PRI)) (priority != TIPC_MEDIA_LINK_PRI)) {
warn("Bearer <%s> rejected, illegal priority\n", name);
return -EINVAL; return -EINVAL;
}
write_lock_bh(&tipc_net_lock); write_lock_bh(&tipc_net_lock);
if (!tipc_bearers)
goto failed;
m_ptr = media_find(b_name.media_name); m_ptr = media_find(b_name.media_name);
if (!m_ptr) { if (!m_ptr) {
warn("No media <%s>\n", b_name.media_name); warn("Bearer <%s> rejected, media <%s> not registered\n", name,
b_name.media_name);
goto failed; goto failed;
} }
...@@ -510,23 +523,24 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) ...@@ -510,23 +523,24 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority)
continue; continue;
} }
if (!strcmp(name, tipc_bearers[i].publ.name)) { if (!strcmp(name, tipc_bearers[i].publ.name)) {
warn("Bearer <%s> already enabled\n", name); warn("Bearer <%s> rejected, already enabled\n", name);
goto failed; goto failed;
} }
if ((tipc_bearers[i].priority == priority) && if ((tipc_bearers[i].priority == priority) &&
(++with_this_prio > 2)) { (++with_this_prio > 2)) {
if (priority-- == 0) { if (priority-- == 0) {
warn("Third bearer <%s> with priority %u, unable to lower to %u\n", warn("Bearer <%s> rejected, duplicate priority\n",
name, priority + 1, priority); name);
goto failed; goto failed;
} }
warn("Third bearer <%s> with priority %u, lowering to %u\n", warn("Bearer <%s> priority adjustment required %u->%u\n",
name, priority + 1, priority); name, priority + 1, priority);
goto restart; goto restart;
} }
} }
if (bearer_id >= MAX_BEARERS) { if (bearer_id >= MAX_BEARERS) {
warn("Attempt to enable more than %d bearers\n", MAX_BEARERS); warn("Bearer <%s> rejected, bearer limit reached (%u)\n",
name, MAX_BEARERS);
goto failed; goto failed;
} }
...@@ -536,7 +550,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority) ...@@ -536,7 +550,7 @@ int tipc_enable_bearer(const char *name, u32 bcast_scope, u32 priority)
strcpy(b_ptr->publ.name, name); strcpy(b_ptr->publ.name, name);
res = m_ptr->enable_bearer(&b_ptr->publ); res = m_ptr->enable_bearer(&b_ptr->publ);
if (res) { if (res) {
warn("Failed to enable bearer <%s>\n", name); warn("Bearer <%s> rejected, enable failure (%d)\n", name, -res);
goto failed; goto failed;
} }
...@@ -573,9 +587,6 @@ int tipc_block_bearer(const char *name) ...@@ -573,9 +587,6 @@ int tipc_block_bearer(const char *name)
struct link *l_ptr; struct link *l_ptr;
struct link *temp_l_ptr; struct link *temp_l_ptr;
if (tipc_mode != TIPC_NET_MODE)
return -ENOPROTOOPT;
read_lock_bh(&tipc_net_lock); read_lock_bh(&tipc_net_lock);
b_ptr = bearer_find(name); b_ptr = bearer_find(name);
if (!b_ptr) { if (!b_ptr) {
...@@ -584,6 +595,7 @@ int tipc_block_bearer(const char *name) ...@@ -584,6 +595,7 @@ int tipc_block_bearer(const char *name)
return -EINVAL; return -EINVAL;
} }
info("Blocking bearer <%s>\n", name);
spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->publ.lock);
b_ptr->publ.blocked = 1; b_ptr->publ.blocked = 1;
list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) {
...@@ -595,7 +607,6 @@ int tipc_block_bearer(const char *name) ...@@ -595,7 +607,6 @@ int tipc_block_bearer(const char *name)
} }
spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->publ.lock);
read_unlock_bh(&tipc_net_lock); read_unlock_bh(&tipc_net_lock);
info("Blocked bearer <%s>\n", name);
return TIPC_OK; return TIPC_OK;
} }
...@@ -611,15 +622,13 @@ static int bearer_disable(const char *name) ...@@ -611,15 +622,13 @@ static int bearer_disable(const char *name)
struct link *l_ptr; struct link *l_ptr;
struct link *temp_l_ptr; struct link *temp_l_ptr;
if (tipc_mode != TIPC_NET_MODE)
return -ENOPROTOOPT;
b_ptr = bearer_find(name); b_ptr = bearer_find(name);
if (!b_ptr) { if (!b_ptr) {
warn("Attempt to disable unknown bearer <%s>\n", name); warn("Attempt to disable unknown bearer <%s>\n", name);
return -EINVAL; return -EINVAL;
} }
info("Disabling bearer <%s>\n", name);
tipc_disc_stop_link_req(b_ptr->link_req); tipc_disc_stop_link_req(b_ptr->link_req);
spin_lock_bh(&b_ptr->publ.lock); spin_lock_bh(&b_ptr->publ.lock);
b_ptr->link_req = NULL; b_ptr->link_req = NULL;
...@@ -635,7 +644,6 @@ static int bearer_disable(const char *name) ...@@ -635,7 +644,6 @@ static int bearer_disable(const char *name)
tipc_link_delete(l_ptr); tipc_link_delete(l_ptr);
} }
spin_unlock_bh(&b_ptr->publ.lock); spin_unlock_bh(&b_ptr->publ.lock);
info("Disabled bearer <%s>\n", name);
memset(b_ptr, 0, sizeof(struct bearer)); memset(b_ptr, 0, sizeof(struct bearer));
return TIPC_OK; return TIPC_OK;
} }
......
...@@ -60,8 +60,10 @@ struct cluster *tipc_cltr_create(u32 addr) ...@@ -60,8 +60,10 @@ struct cluster *tipc_cltr_create(u32 addr)
int alloc; int alloc;
c_ptr = (struct cluster *)kmalloc(sizeof(*c_ptr), GFP_ATOMIC); c_ptr = (struct cluster *)kmalloc(sizeof(*c_ptr), GFP_ATOMIC);
if (c_ptr == NULL) if (c_ptr == NULL) {
warn("Cluster creation failure, no memory\n");
return NULL; return NULL;
}
memset(c_ptr, 0, sizeof(*c_ptr)); memset(c_ptr, 0, sizeof(*c_ptr));
c_ptr->addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0); c_ptr->addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0);
...@@ -70,30 +72,32 @@ struct cluster *tipc_cltr_create(u32 addr) ...@@ -70,30 +72,32 @@ struct cluster *tipc_cltr_create(u32 addr)
else else
max_nodes = tipc_max_nodes + 1; max_nodes = tipc_max_nodes + 1;
alloc = sizeof(void *) * (max_nodes + 1); alloc = sizeof(void *) * (max_nodes + 1);
c_ptr->nodes = (struct node **)kmalloc(alloc, GFP_ATOMIC); c_ptr->nodes = (struct node **)kmalloc(alloc, GFP_ATOMIC);
if (c_ptr->nodes == NULL) { if (c_ptr->nodes == NULL) {
warn("Cluster creation failure, no memory for node area\n");
kfree(c_ptr); kfree(c_ptr);
return NULL; return NULL;
} }
memset(c_ptr->nodes, 0, alloc); memset(c_ptr->nodes, 0, alloc);
if (in_own_cluster(addr)) if (in_own_cluster(addr))
tipc_local_nodes = c_ptr->nodes; tipc_local_nodes = c_ptr->nodes;
c_ptr->highest_slave = LOWEST_SLAVE - 1; c_ptr->highest_slave = LOWEST_SLAVE - 1;
c_ptr->highest_node = 0; c_ptr->highest_node = 0;
z_ptr = tipc_zone_find(tipc_zone(addr)); z_ptr = tipc_zone_find(tipc_zone(addr));
if (z_ptr == NULL) { if (!z_ptr) {
z_ptr = tipc_zone_create(addr); z_ptr = tipc_zone_create(addr);
} }
if (z_ptr != NULL) { if (!z_ptr) {
tipc_zone_attach_cluster(z_ptr, c_ptr); kfree(c_ptr->nodes);
c_ptr->owner = z_ptr;
}
else {
kfree(c_ptr); kfree(c_ptr);
c_ptr = NULL; return NULL;
} }
tipc_zone_attach_cluster(z_ptr, c_ptr);
c_ptr->owner = z_ptr;
return c_ptr; return c_ptr;
} }
......
...@@ -642,7 +642,7 @@ static void cfg_named_msg_event(void *userdata, ...@@ -642,7 +642,7 @@ static void cfg_named_msg_event(void *userdata,
if ((size < sizeof(*req_hdr)) || if ((size < sizeof(*req_hdr)) ||
(size != TCM_ALIGN(ntohl(req_hdr->tcm_len))) || (size != TCM_ALIGN(ntohl(req_hdr->tcm_len))) ||
(ntohs(req_hdr->tcm_flags) != TCM_F_REQUEST)) { (ntohs(req_hdr->tcm_flags) != TCM_F_REQUEST)) {
warn("discarded invalid configuration message\n"); warn("Invalid configuration message discarded\n");
return; return;
} }
......
...@@ -176,7 +176,6 @@ void tipc_disc_recv_msg(struct sk_buff *buf) ...@@ -176,7 +176,6 @@ void tipc_disc_recv_msg(struct sk_buff *buf)
n_ptr = tipc_node_create(orig); n_ptr = tipc_node_create(orig);
} }
if (n_ptr == NULL) { if (n_ptr == NULL) {
warn("Memory squeeze; Failed to create node\n");
return; return;
} }
spin_lock_bh(&n_ptr->lock); spin_lock_bh(&n_ptr->lock);
...@@ -191,10 +190,8 @@ void tipc_disc_recv_msg(struct sk_buff *buf) ...@@ -191,10 +190,8 @@ void tipc_disc_recv_msg(struct sk_buff *buf)
} }
addr = &link->media_addr; addr = &link->media_addr;
if (memcmp(addr, &media_addr, sizeof(*addr))) { if (memcmp(addr, &media_addr, sizeof(*addr))) {
char addr_string[16]; warn("Resetting link <%s>, peer interface address changed\n",
link->name);
warn("New bearer address for %s\n",
addr_string_fill(addr_string, orig));
memcpy(addr, &media_addr, sizeof(*addr)); memcpy(addr, &media_addr, sizeof(*addr));
tipc_link_reset(link); tipc_link_reset(link);
} }
......
...@@ -419,7 +419,7 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer, ...@@ -419,7 +419,7 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
l_ptr = (struct link *)kmalloc(sizeof(*l_ptr), GFP_ATOMIC); l_ptr = (struct link *)kmalloc(sizeof(*l_ptr), GFP_ATOMIC);
if (!l_ptr) { if (!l_ptr) {
warn("Memory squeeze; Failed to create link\n"); warn("Link creation failed, no memory\n");
return NULL; return NULL;
} }
memset(l_ptr, 0, sizeof(*l_ptr)); memset(l_ptr, 0, sizeof(*l_ptr));
...@@ -469,7 +469,7 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer, ...@@ -469,7 +469,7 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
if (!pb) { if (!pb) {
kfree(l_ptr); kfree(l_ptr);
warn("Memory squeeze; Failed to create link\n"); warn("Link creation failed, no memory for print buffer\n");
return NULL; return NULL;
} }
tipc_printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE); tipc_printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE);
...@@ -819,6 +819,8 @@ static void link_state_event(struct link *l_ptr, unsigned event) ...@@ -819,6 +819,8 @@ static void link_state_event(struct link *l_ptr, unsigned event)
break; break;
case RESET_MSG: case RESET_MSG:
dbg_link("RES -> RR\n"); dbg_link("RES -> RR\n");
info("Resetting link <%s>, requested by peer\n",
l_ptr->name);
tipc_link_reset(l_ptr); tipc_link_reset(l_ptr);
l_ptr->state = RESET_RESET; l_ptr->state = RESET_RESET;
l_ptr->fsm_msg_cnt = 0; l_ptr->fsm_msg_cnt = 0;
...@@ -843,6 +845,8 @@ static void link_state_event(struct link *l_ptr, unsigned event) ...@@ -843,6 +845,8 @@ static void link_state_event(struct link *l_ptr, unsigned event)
break; break;
case RESET_MSG: case RESET_MSG:
dbg_link("RES -> RR\n"); dbg_link("RES -> RR\n");
info("Resetting link <%s>, requested by peer "
"while probing\n", l_ptr->name);
tipc_link_reset(l_ptr); tipc_link_reset(l_ptr);
l_ptr->state = RESET_RESET; l_ptr->state = RESET_RESET;
l_ptr->fsm_msg_cnt = 0; l_ptr->fsm_msg_cnt = 0;
...@@ -874,6 +878,8 @@ static void link_state_event(struct link *l_ptr, unsigned event) ...@@ -874,6 +878,8 @@ static void link_state_event(struct link *l_ptr, unsigned event)
} else { /* Link has failed */ } else { /* Link has failed */
dbg_link("-> RU (%u probes unanswered)\n", dbg_link("-> RU (%u probes unanswered)\n",
l_ptr->fsm_msg_cnt); l_ptr->fsm_msg_cnt);
warn("Resetting link <%s>, peer not responding\n",
l_ptr->name);
tipc_link_reset(l_ptr); tipc_link_reset(l_ptr);
l_ptr->state = RESET_UNKNOWN; l_ptr->state = RESET_UNKNOWN;
l_ptr->fsm_msg_cnt = 0; l_ptr->fsm_msg_cnt = 0;
...@@ -1049,7 +1055,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf) ...@@ -1049,7 +1055,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf)
msg_dbg(msg, "TIPC: Congestion, throwing away\n"); msg_dbg(msg, "TIPC: Congestion, throwing away\n");
buf_discard(buf); buf_discard(buf);
if (imp > CONN_MANAGER) { if (imp > CONN_MANAGER) {
warn("Resetting <%s>, send queue full", l_ptr->name); warn("Resetting link <%s>, send queue full", l_ptr->name);
tipc_link_reset(l_ptr); tipc_link_reset(l_ptr);
} }
return dsz; return dsz;
...@@ -2228,7 +2234,7 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) ...@@ -2228,7 +2234,7 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
if (msg_linkprio(msg) && if (msg_linkprio(msg) &&
(msg_linkprio(msg) != l_ptr->priority)) { (msg_linkprio(msg) != l_ptr->priority)) {
warn("Changing prio <%s>: %u->%u\n", warn("Resetting link <%s>, priority change %u->%u\n",
l_ptr->name, l_ptr->priority, msg_linkprio(msg)); l_ptr->name, l_ptr->priority, msg_linkprio(msg));
l_ptr->priority = msg_linkprio(msg); l_ptr->priority = msg_linkprio(msg);
tipc_link_reset(l_ptr); /* Enforce change to take effect */ tipc_link_reset(l_ptr); /* Enforce change to take effect */
...@@ -2348,7 +2354,8 @@ void tipc_link_changeover(struct link *l_ptr) ...@@ -2348,7 +2354,8 @@ void tipc_link_changeover(struct link *l_ptr)
msg_dbg(&tunnel_hdr, "EMPTY>SEND>"); msg_dbg(&tunnel_hdr, "EMPTY>SEND>");
tipc_link_send_buf(tunnel, buf); tipc_link_send_buf(tunnel, buf);
} else { } else {
warn("Memory squeeze; link changeover failed\n"); warn("Link changeover error, "
"unable to send changeover msg\n");
} }
return; return;
} }
...@@ -2398,7 +2405,8 @@ void tipc_link_send_duplicate(struct link *l_ptr, struct link *tunnel) ...@@ -2398,7 +2405,8 @@ void tipc_link_send_duplicate(struct link *l_ptr, struct link *tunnel)
msg_set_size(&tunnel_hdr, length + INT_H_SIZE); msg_set_size(&tunnel_hdr, length + INT_H_SIZE);
outbuf = buf_acquire(length + INT_H_SIZE); outbuf = buf_acquire(length + INT_H_SIZE);
if (outbuf == NULL) { if (outbuf == NULL) {
warn("Memory squeeze; buffer duplication failed\n"); warn("Link changeover error, "
"unable to send duplicate msg\n");
return; return;
} }
memcpy(outbuf->data, (unchar *)&tunnel_hdr, INT_H_SIZE); memcpy(outbuf->data, (unchar *)&tunnel_hdr, INT_H_SIZE);
...@@ -2473,7 +2481,7 @@ static int link_recv_changeover_msg(struct link **l_ptr, ...@@ -2473,7 +2481,7 @@ static int link_recv_changeover_msg(struct link **l_ptr,
} }
*buf = buf_extract(tunnel_buf,INT_H_SIZE); *buf = buf_extract(tunnel_buf,INT_H_SIZE);
if (*buf == NULL) { if (*buf == NULL) {
warn("Memory squeeze; failed to extract msg\n"); warn("Link changeover error, duplicate msg dropped\n");
goto exit; goto exit;
} }
msg_dbg(tunnel_msg, "TNL<REC<"); msg_dbg(tunnel_msg, "TNL<REC<");
...@@ -2485,6 +2493,8 @@ static int link_recv_changeover_msg(struct link **l_ptr, ...@@ -2485,6 +2493,8 @@ static int link_recv_changeover_msg(struct link **l_ptr,
if (tipc_link_is_up(dest_link)) { if (tipc_link_is_up(dest_link)) {
msg_dbg(tunnel_msg, "UP/FIRST/<REC<"); msg_dbg(tunnel_msg, "UP/FIRST/<REC<");
info("Resetting link <%s>, changeover initiated by peer\n",
dest_link->name);
tipc_link_reset(dest_link); tipc_link_reset(dest_link);
dest_link->exp_msg_count = msg_count; dest_link->exp_msg_count = msg_count;
if (!msg_count) if (!msg_count)
...@@ -2514,7 +2524,7 @@ static int link_recv_changeover_msg(struct link **l_ptr, ...@@ -2514,7 +2524,7 @@ static int link_recv_changeover_msg(struct link **l_ptr,
buf_discard(tunnel_buf); buf_discard(tunnel_buf);
return 1; return 1;
} else { } else {
warn("Memory squeeze; dropped incoming msg\n"); warn("Link changeover error, original msg dropped\n");
} }
} }
exit: exit:
...@@ -2536,13 +2546,8 @@ void tipc_link_recv_bundle(struct sk_buff *buf) ...@@ -2536,13 +2546,8 @@ void tipc_link_recv_bundle(struct sk_buff *buf)
while (msgcount--) { while (msgcount--) {
obuf = buf_extract(buf, pos); obuf = buf_extract(buf, pos);
if (obuf == NULL) { if (obuf == NULL) {
char addr_string[16]; warn("Link unable to unbundle message(s)\n");
break;
warn("Buffer allocation failure;\n");
warn(" incoming message(s) from %s lost\n",
addr_string_fill(addr_string,
msg_orignode(buf_msg(buf))));
return;
}; };
pos += align(msg_size(buf_msg(obuf))); pos += align(msg_size(buf_msg(obuf)));
msg_dbg(buf_msg(obuf), " /"); msg_dbg(buf_msg(obuf), " /");
...@@ -2600,7 +2605,7 @@ int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf) ...@@ -2600,7 +2605,7 @@ int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
} }
fragm = buf_acquire(fragm_sz + INT_H_SIZE); fragm = buf_acquire(fragm_sz + INT_H_SIZE);
if (fragm == NULL) { if (fragm == NULL) {
warn("Memory squeeze; failed to fragment msg\n"); warn("Link unable to fragment message\n");
dsz = -ENOMEM; dsz = -ENOMEM;
goto exit; goto exit;
} }
...@@ -2715,7 +2720,7 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb, ...@@ -2715,7 +2720,7 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
set_fragm_size(pbuf,fragm_sz); set_fragm_size(pbuf,fragm_sz);
set_expected_frags(pbuf,exp_fragm_cnt - 1); set_expected_frags(pbuf,exp_fragm_cnt - 1);
} else { } else {
warn("Memory squeeze; got no defragmenting buffer\n"); warn("Link unable to reassemble fragmented message\n");
} }
buf_discard(fbuf); buf_discard(fbuf);
return 0; return 0;
......
...@@ -127,7 +127,7 @@ void tipc_named_publish(struct publication *publ) ...@@ -127,7 +127,7 @@ void tipc_named_publish(struct publication *publ)
buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0); buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0);
if (!buf) { if (!buf) {
warn("Memory squeeze; failed to distribute publication\n"); warn("Publication distribution failure\n");
return; return;
} }
...@@ -151,7 +151,7 @@ void tipc_named_withdraw(struct publication *publ) ...@@ -151,7 +151,7 @@ void tipc_named_withdraw(struct publication *publ)
buf = named_prepare_buf(WITHDRAWAL, ITEM_SIZE, 0); buf = named_prepare_buf(WITHDRAWAL, ITEM_SIZE, 0);
if (!buf) { if (!buf) {
warn("Memory squeeze; failed to distribute withdrawal\n"); warn("Withdrawl distribution failure\n");
return; return;
} }
...@@ -184,8 +184,8 @@ void tipc_named_node_up(unsigned long node) ...@@ -184,8 +184,8 @@ void tipc_named_node_up(unsigned long node)
left = (rest <= max_item_buf) ? rest : max_item_buf; left = (rest <= max_item_buf) ? rest : max_item_buf;
rest -= left; rest -= left;
buf = named_prepare_buf(PUBLICATION, left, node); buf = named_prepare_buf(PUBLICATION, left, node);
if (buf == NULL) { if (!buf) {
warn("Memory Squeeze; could not send publication\n"); warn("Bulk publication distribution failure\n");
goto exit; goto exit;
} }
item = (struct distr_item *)msg_data(buf_msg(buf)); item = (struct distr_item *)msg_data(buf_msg(buf));
...@@ -291,7 +291,7 @@ void tipc_named_recv(struct sk_buff *buf) ...@@ -291,7 +291,7 @@ void tipc_named_recv(struct sk_buff *buf)
ntohl(item->ref), ntohl(item->key)); ntohl(item->ref), ntohl(item->key));
} }
} else { } else {
warn("tipc_named_recv: unknown msg\n"); warn("Unrecognized name table message received\n");
} }
item++; item++;
} }
......
...@@ -120,7 +120,7 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper, ...@@ -120,7 +120,7 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper,
struct publication *publ = struct publication *publ =
(struct publication *)kmalloc(sizeof(*publ), GFP_ATOMIC); (struct publication *)kmalloc(sizeof(*publ), GFP_ATOMIC);
if (publ == NULL) { if (publ == NULL) {
warn("Memory squeeze; failed to create publication\n"); warn("Publication creation failure, no memory\n");
return NULL; return NULL;
} }
...@@ -165,7 +165,7 @@ static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_hea ...@@ -165,7 +165,7 @@ static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_hea
struct sub_seq *sseq = tipc_subseq_alloc(1); struct sub_seq *sseq = tipc_subseq_alloc(1);
if (!nseq || !sseq) { if (!nseq || !sseq) {
warn("Memory squeeze; failed to create name sequence\n"); warn("Name sequence creation failed, no memory\n");
kfree(nseq); kfree(nseq);
kfree(sseq); kfree(sseq);
return NULL; return NULL;
...@@ -759,7 +759,7 @@ struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper, ...@@ -759,7 +759,7 @@ struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
struct publication *publ; struct publication *publ;
if (table.local_publ_count >= tipc_max_publications) { if (table.local_publ_count >= tipc_max_publications) {
warn("Failed publish: max %u local publication\n", warn("Publication failed, local publication limit reached (%u)\n",
tipc_max_publications); tipc_max_publications);
return NULL; return NULL;
} }
......
...@@ -61,34 +61,37 @@ struct node *tipc_node_create(u32 addr) ...@@ -61,34 +61,37 @@ struct node *tipc_node_create(u32 addr)
struct node **curr_node; struct node **curr_node;
n_ptr = kmalloc(sizeof(*n_ptr),GFP_ATOMIC); n_ptr = kmalloc(sizeof(*n_ptr),GFP_ATOMIC);
if (n_ptr != NULL) { if (!n_ptr) {
memset(n_ptr, 0, sizeof(*n_ptr)); warn("Node creation failed, no memory\n");
n_ptr->addr = addr; return NULL;
n_ptr->lock = SPIN_LOCK_UNLOCKED; }
INIT_LIST_HEAD(&n_ptr->nsub);
c_ptr = tipc_cltr_find(addr);
c_ptr = tipc_cltr_find(addr); if (!c_ptr) {
if (c_ptr == NULL) c_ptr = tipc_cltr_create(addr);
c_ptr = tipc_cltr_create(addr); }
if (c_ptr != NULL) { if (!c_ptr) {
n_ptr->owner = c_ptr; kfree(n_ptr);
tipc_cltr_attach_node(c_ptr, n_ptr); return NULL;
n_ptr->last_router = -1; }
/* Insert node into ordered list */ memset(n_ptr, 0, sizeof(*n_ptr));
for (curr_node = &tipc_nodes; *curr_node; n_ptr->addr = addr;
curr_node = &(*curr_node)->next) { n_ptr->lock = SPIN_LOCK_UNLOCKED;
if (addr < (*curr_node)->addr) { INIT_LIST_HEAD(&n_ptr->nsub);
n_ptr->next = *curr_node; n_ptr->owner = c_ptr;
break; tipc_cltr_attach_node(c_ptr, n_ptr);
} n_ptr->last_router = -1;
}
(*curr_node) = n_ptr; /* Insert node into ordered list */
} else { for (curr_node = &tipc_nodes; *curr_node;
kfree(n_ptr); curr_node = &(*curr_node)->next) {
n_ptr = NULL; if (addr < (*curr_node)->addr) {
} n_ptr->next = *curr_node;
} break;
}
}
(*curr_node) = n_ptr;
return n_ptr; return n_ptr;
} }
...@@ -132,7 +135,7 @@ void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr) ...@@ -132,7 +135,7 @@ void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr)
return; return;
} }
if (l_ptr->priority < active[0]->priority) { if (l_ptr->priority < active[0]->priority) {
info("Link is standby\n"); info("New link <%s> becomes standby\n", l_ptr->name);
return; return;
} }
tipc_link_send_duplicate(active[0], l_ptr); tipc_link_send_duplicate(active[0], l_ptr);
...@@ -140,8 +143,9 @@ void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr) ...@@ -140,8 +143,9 @@ void tipc_node_link_up(struct node *n_ptr, struct link *l_ptr)
active[0] = l_ptr; active[0] = l_ptr;
return; return;
} }
info("Link <%s> on network plane %c becomes standby\n", info("Old link <%s> becomes standby\n", active[0]->name);
active[0]->name, active[0]->b_ptr->net_plane); if (active[1] != active[0])
info("Old link <%s> becomes standby\n", active[1]->name);
active[0] = active[1] = l_ptr; active[0] = active[1] = l_ptr;
} }
...@@ -248,7 +252,7 @@ struct node *tipc_node_attach_link(struct link *l_ptr) ...@@ -248,7 +252,7 @@ struct node *tipc_node_attach_link(struct link *l_ptr)
n_ptr->link_cnt++; n_ptr->link_cnt++;
return n_ptr; return n_ptr;
} }
err("Attempt to establish second link on <%s> to <%s> \n", err("Attempt to establish second link on <%s> to %s \n",
l_ptr->b_ptr->publ.name, l_ptr->b_ptr->publ.name,
addr_string_fill(addr_string, l_ptr->addr)); addr_string_fill(addr_string, l_ptr->addr));
} }
......
...@@ -195,7 +195,7 @@ void tipc_port_recv_mcast(struct sk_buff *buf, struct port_list *dp) ...@@ -195,7 +195,7 @@ void tipc_port_recv_mcast(struct sk_buff *buf, struct port_list *dp)
struct sk_buff *b = skb_clone(buf, GFP_ATOMIC); struct sk_buff *b = skb_clone(buf, GFP_ATOMIC);
if (b == NULL) { if (b == NULL) {
warn("Buffer allocation failure\n"); warn("Unable to deliver multicast message(s)\n");
msg_dbg(msg, "LOST:"); msg_dbg(msg, "LOST:");
goto exit; goto exit;
} }
...@@ -227,14 +227,14 @@ u32 tipc_createport_raw(void *usr_handle, ...@@ -227,14 +227,14 @@ u32 tipc_createport_raw(void *usr_handle,
u32 ref; u32 ref;
p_ptr = kmalloc(sizeof(*p_ptr), GFP_ATOMIC); p_ptr = kmalloc(sizeof(*p_ptr), GFP_ATOMIC);
if (p_ptr == NULL) { if (!p_ptr) {
warn("Memory squeeze; failed to create port\n"); warn("Port creation failed, no memory\n");
return 0; return 0;
} }
memset(p_ptr, 0, sizeof(*p_ptr)); memset(p_ptr, 0, sizeof(*p_ptr));
ref = tipc_ref_acquire(p_ptr, &p_ptr->publ.lock); ref = tipc_ref_acquire(p_ptr, &p_ptr->publ.lock);
if (!ref) { if (!ref) {
warn("Reference Table Exhausted\n"); warn("Port creation failed, reference table exhausted\n");
kfree(p_ptr); kfree(p_ptr);
return 0; return 0;
} }
...@@ -1059,7 +1059,7 @@ int tipc_createport(u32 user_ref, ...@@ -1059,7 +1059,7 @@ int tipc_createport(u32 user_ref,
u32 ref; u32 ref;
up_ptr = (struct user_port *)kmalloc(sizeof(*up_ptr), GFP_ATOMIC); up_ptr = (struct user_port *)kmalloc(sizeof(*up_ptr), GFP_ATOMIC);
if (up_ptr == NULL) { if (!up_ptr) {
warn("Port creation failed, no memory\n"); warn("Port creation failed, no memory\n");
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -266,7 +266,8 @@ static void subscr_subscribe(struct tipc_subscr *s, ...@@ -266,7 +266,8 @@ static void subscr_subscribe(struct tipc_subscr *s,
/* Refuse subscription if global limit exceeded */ /* Refuse subscription if global limit exceeded */
if (atomic_read(&topsrv.subscription_count) >= tipc_max_subscriptions) { if (atomic_read(&topsrv.subscription_count) >= tipc_max_subscriptions) {
warn("Failed: max %u subscriptions\n", tipc_max_subscriptions); warn("Subscription rejected, subscription limit reached (%u)\n",
tipc_max_subscriptions);
subscr_terminate(subscriber); subscr_terminate(subscriber);
return; return;
} }
...@@ -274,8 +275,8 @@ static void subscr_subscribe(struct tipc_subscr *s, ...@@ -274,8 +275,8 @@ static void subscr_subscribe(struct tipc_subscr *s,
/* Allocate subscription object */ /* Allocate subscription object */
sub = kmalloc(sizeof(*sub), GFP_ATOMIC); sub = kmalloc(sizeof(*sub), GFP_ATOMIC);
if (sub == NULL) { if (!sub) {
warn("Memory squeeze; ignoring subscription\n"); warn("Subscription rejected, no memory\n");
subscr_terminate(subscriber); subscr_terminate(subscriber);
return; return;
} }
...@@ -298,8 +299,7 @@ static void subscr_subscribe(struct tipc_subscr *s, ...@@ -298,8 +299,7 @@ static void subscr_subscribe(struct tipc_subscr *s,
if ((((sub->filter != TIPC_SUB_PORTS) if ((((sub->filter != TIPC_SUB_PORTS)
&& (sub->filter != TIPC_SUB_SERVICE))) && (sub->filter != TIPC_SUB_SERVICE)))
|| (sub->seq.lower > sub->seq.upper)) { || (sub->seq.lower > sub->seq.upper)) {
warn("Rejecting illegal subscription %u,%u,%u\n", warn("Subscription rejected, illegal request\n");
sub->seq.type, sub->seq.lower, sub->seq.upper);
kfree(sub); kfree(sub);
subscr_terminate(subscriber); subscr_terminate(subscriber);
return; return;
...@@ -387,7 +387,7 @@ static void subscr_named_msg_event(void *usr_handle, ...@@ -387,7 +387,7 @@ static void subscr_named_msg_event(void *usr_handle,
dbg("subscr_named_msg_event: orig = %x own = %x,\n", dbg("subscr_named_msg_event: orig = %x own = %x,\n",
orig->node, tipc_own_addr); orig->node, tipc_own_addr);
if (size && (size != sizeof(struct tipc_subscr))) { if (size && (size != sizeof(struct tipc_subscr))) {
warn("Received tipc_subscr of invalid size\n"); warn("Subscriber rejected, invalid subscription size\n");
return; return;
} }
...@@ -395,7 +395,7 @@ static void subscr_named_msg_event(void *usr_handle, ...@@ -395,7 +395,7 @@ static void subscr_named_msg_event(void *usr_handle,
subscriber = kmalloc(sizeof(struct subscriber), GFP_ATOMIC); subscriber = kmalloc(sizeof(struct subscriber), GFP_ATOMIC);
if (subscriber == NULL) { if (subscriber == NULL) {
warn("Memory squeeze; ignoring subscriber setup\n"); warn("Subscriber rejected, no memory\n");
return; return;
} }
memset(subscriber, 0, sizeof(struct subscriber)); memset(subscriber, 0, sizeof(struct subscriber));
...@@ -403,7 +403,7 @@ static void subscr_named_msg_event(void *usr_handle, ...@@ -403,7 +403,7 @@ static void subscr_named_msg_event(void *usr_handle,
INIT_LIST_HEAD(&subscriber->subscriber_list); INIT_LIST_HEAD(&subscriber->subscriber_list);
subscriber->ref = tipc_ref_acquire(subscriber, &subscriber->lock); subscriber->ref = tipc_ref_acquire(subscriber, &subscriber->lock);
if (subscriber->ref == 0) { if (subscriber->ref == 0) {
warn("Failed to acquire subscriber reference\n"); warn("Subscriber rejected, reference table exhausted\n");
kfree(subscriber); kfree(subscriber);
return; return;
} }
...@@ -422,7 +422,7 @@ static void subscr_named_msg_event(void *usr_handle, ...@@ -422,7 +422,7 @@ static void subscr_named_msg_event(void *usr_handle,
NULL, NULL,
&subscriber->port_ref); &subscriber->port_ref);
if (subscriber->port_ref == 0) { if (subscriber->port_ref == 0) {
warn("Memory squeeze; failed to create subscription port\n"); warn("Subscriber rejected, unable to create port\n");
tipc_ref_discard(subscriber->ref); tipc_ref_discard(subscriber->ref);
kfree(subscriber); kfree(subscriber);
return; return;
......
...@@ -44,19 +44,24 @@ ...@@ -44,19 +44,24 @@
struct _zone *tipc_zone_create(u32 addr) struct _zone *tipc_zone_create(u32 addr)
{ {
struct _zone *z_ptr = NULL; struct _zone *z_ptr;
u32 z_num; u32 z_num;
if (!tipc_addr_domain_valid(addr)) if (!tipc_addr_domain_valid(addr)) {
err("Zone creation failed, invalid domain 0x%x\n", addr);
return NULL; return NULL;
}
z_ptr = (struct _zone *)kmalloc(sizeof(*z_ptr), GFP_ATOMIC); z_ptr = (struct _zone *)kmalloc(sizeof(*z_ptr), GFP_ATOMIC);
if (z_ptr != NULL) { if (!z_ptr) {
memset(z_ptr, 0, sizeof(*z_ptr)); warn("Zone creation failed, insufficient memory\n");
z_num = tipc_zone(addr); return NULL;
z_ptr->addr = tipc_addr(z_num, 0, 0);
tipc_net.zones[z_num] = z_ptr;
} }
memset(z_ptr, 0, sizeof(*z_ptr));
z_num = tipc_zone(addr);
z_ptr->addr = tipc_addr(z_num, 0, 0);
tipc_net.zones[z_num] = z_ptr;
return z_ptr; return z_ptr;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment