mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
[NET] TIPC: Fix whitespace errors.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
cca5172a7e
commit
c430728526
44 changed files with 1200 additions and 1200 deletions
|
@ -714,7 +714,7 @@ int tipc_bclink_stats(char *buf, const u32 buf_size)
|
|||
spin_lock_bh(&bc_lock);
|
||||
|
||||
tipc_printf(&pb, "Link <%s>\n"
|
||||
" Window:%u packets\n",
|
||||
" Window:%u packets\n",
|
||||
bcl->name, bcl->queue_limit[0]);
|
||||
tipc_printf(&pb, " RX packets:%u fragments:%u/%u bundles:%u/%u\n",
|
||||
bcl->stats.recv_info,
|
||||
|
@ -778,7 +778,7 @@ int tipc_bclink_init(void)
|
|||
bclink = kzalloc(sizeof(*bclink), GFP_ATOMIC);
|
||||
if (!bcbearer || !bclink) {
|
||||
nomem:
|
||||
warn("Multicast link creation failed, no memory\n");
|
||||
warn("Multicast link creation failed, no memory\n");
|
||||
kfree(bcbearer);
|
||||
bcbearer = NULL;
|
||||
kfree(bclink);
|
||||
|
@ -796,7 +796,7 @@ int tipc_bclink_init(void)
|
|||
bcl->next_out_no = 1;
|
||||
spin_lock_init(&bclink->node.lock);
|
||||
bcl->owner = &bclink->node;
|
||||
bcl->max_pkt = MAX_PKT_DEFAULT_MCAST;
|
||||
bcl->max_pkt = MAX_PKT_DEFAULT_MCAST;
|
||||
tipc_link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT);
|
||||
bcl->b_ptr = &bcbearer->bearer;
|
||||
bcl->state = WORKING_WORKING;
|
||||
|
|
|
@ -176,7 +176,7 @@ int tipc_core_start(void)
|
|||
tipc_random)) ||
|
||||
(res = tipc_reg_start()) ||
|
||||
(res = tipc_nametbl_init()) ||
|
||||
(res = tipc_k_signal((Handler)tipc_subscr_start, 0)) ||
|
||||
(res = tipc_k_signal((Handler)tipc_subscr_start, 0)) ||
|
||||
(res = tipc_k_signal((Handler)tipc_cfg_init, 0)) ||
|
||||
(res = tipc_netlink_start()) ||
|
||||
(res = tipc_socket_init())) {
|
||||
|
@ -209,7 +209,7 @@ static int __init tipc_init(void)
|
|||
err("Unable to start in single node mode\n");
|
||||
else
|
||||
info("Started in single node mode\n");
|
||||
return res;
|
||||
return res;
|
||||
}
|
||||
|
||||
static void __exit tipc_exit(void)
|
||||
|
|
|
@ -132,25 +132,25 @@ int tipc_printbuf_empty(struct print_buf *pb)
|
|||
|
||||
int tipc_printbuf_validate(struct print_buf *pb)
|
||||
{
|
||||
char *err = "\n\n*** PRINT BUFFER OVERFLOW ***\n\n";
|
||||
char *cp_buf;
|
||||
struct print_buf cb;
|
||||
char *err = "\n\n*** PRINT BUFFER OVERFLOW ***\n\n";
|
||||
char *cp_buf;
|
||||
struct print_buf cb;
|
||||
|
||||
if (!pb->buf)
|
||||
return 0;
|
||||
|
||||
if (pb->buf[pb->size - 1] == 0) {
|
||||
cp_buf = kmalloc(pb->size, GFP_ATOMIC);
|
||||
if (cp_buf != NULL){
|
||||
tipc_printbuf_init(&cb, cp_buf, pb->size);
|
||||
tipc_printbuf_move(&cb, pb);
|
||||
tipc_printbuf_move(pb, &cb);
|
||||
kfree(cp_buf);
|
||||
memcpy(pb->buf, err, strlen(err));
|
||||
} else {
|
||||
tipc_printbuf_reset(pb);
|
||||
tipc_printf(pb, err);
|
||||
}
|
||||
cp_buf = kmalloc(pb->size, GFP_ATOMIC);
|
||||
if (cp_buf != NULL){
|
||||
tipc_printbuf_init(&cb, cp_buf, pb->size);
|
||||
tipc_printbuf_move(&cb, pb);
|
||||
tipc_printbuf_move(pb, &cb);
|
||||
kfree(cp_buf);
|
||||
memcpy(pb->buf, err, strlen(err));
|
||||
} else {
|
||||
tipc_printbuf_reset(pb);
|
||||
tipc_printf(pb, err);
|
||||
}
|
||||
}
|
||||
return (pb->crs - pb->buf + 1);
|
||||
}
|
||||
|
@ -234,13 +234,13 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...)
|
|||
pb->crs = pb->buf + pb->size - 1;
|
||||
} else {
|
||||
strcpy(pb->buf, print_string + chars_left);
|
||||
save_char = print_string[chars_left];
|
||||
print_string[chars_left] = 0;
|
||||
strcpy(pb->crs, print_string);
|
||||
print_string[chars_left] = save_char;
|
||||
pb->crs = pb->buf + chars_to_add - chars_left;
|
||||
}
|
||||
}
|
||||
save_char = print_string[chars_left];
|
||||
print_string[chars_left] = 0;
|
||||
strcpy(pb->crs, print_string);
|
||||
print_string[chars_left] = save_char;
|
||||
pb->crs = pb->buf + chars_to_add - chars_left;
|
||||
}
|
||||
}
|
||||
pb_next = pb->next;
|
||||
pb->next = NULL;
|
||||
pb = pb_next;
|
||||
|
|
|
@ -99,14 +99,14 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev,
|
|||
|
||||
if (likely(eb_ptr->bearer)) {
|
||||
if (likely(!dev->promiscuity) ||
|
||||
!memcmp(buf->mac.raw,dev->dev_addr,ETH_ALEN) ||
|
||||
!memcmp(buf->mac.raw,dev->broadcast,ETH_ALEN)) {
|
||||
size = msg_size((struct tipc_msg *)buf->data);
|
||||
skb_trim(buf, size);
|
||||
if (likely(buf->len == size)) {
|
||||
buf->next = NULL;
|
||||
tipc_recv_msg(buf, eb_ptr->bearer);
|
||||
return TIPC_OK;
|
||||
!memcmp(buf->mac.raw,dev->dev_addr,ETH_ALEN) ||
|
||||
!memcmp(buf->mac.raw,dev->broadcast,ETH_ALEN)) {
|
||||
size = msg_size((struct tipc_msg *)buf->data);
|
||||
skb_trim(buf, size);
|
||||
if (likely(buf->len == size)) {
|
||||
buf->next = NULL;
|
||||
tipc_recv_msg(buf, eb_ptr->bearer);
|
||||
return TIPC_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt,
|
|||
if (!eb_ptr->bearer)
|
||||
return NOTIFY_DONE; /* bearer had been disabled */
|
||||
|
||||
eb_ptr->bearer->mtu = dev->mtu;
|
||||
eb_ptr->bearer->mtu = dev->mtu;
|
||||
|
||||
switch (evt) {
|
||||
case NETDEV_CHANGE:
|
||||
|
@ -210,12 +210,12 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt,
|
|||
tipc_block_bearer(eb_ptr->bearer->name);
|
||||
break;
|
||||
case NETDEV_CHANGEMTU:
|
||||
case NETDEV_CHANGEADDR:
|
||||
case NETDEV_CHANGEADDR:
|
||||
tipc_block_bearer(eb_ptr->bearer->name);
|
||||
tipc_continue(eb_ptr->bearer);
|
||||
tipc_continue(eb_ptr->bearer);
|
||||
break;
|
||||
case NETDEV_UNREGISTER:
|
||||
case NETDEV_CHANGENAME:
|
||||
case NETDEV_CHANGENAME:
|
||||
tipc_disable_bearer(eb_ptr->bearer->name);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -227,13 +227,13 @@ static void link_init_max_pkt(struct link *l_ptr)
|
|||
if (max_pkt > MAX_MSG_SIZE)
|
||||
max_pkt = MAX_MSG_SIZE;
|
||||
|
||||
l_ptr->max_pkt_target = max_pkt;
|
||||
l_ptr->max_pkt_target = max_pkt;
|
||||
if (l_ptr->max_pkt_target < MAX_PKT_DEFAULT)
|
||||
l_ptr->max_pkt = l_ptr->max_pkt_target;
|
||||
else
|
||||
l_ptr->max_pkt = MAX_PKT_DEFAULT;
|
||||
|
||||
l_ptr->max_pkt_probes = 0;
|
||||
l_ptr->max_pkt_probes = 0;
|
||||
}
|
||||
|
||||
static u32 link_next_sent(struct link *l_ptr)
|
||||
|
@ -693,10 +693,10 @@ void tipc_link_reset(struct link *l_ptr)
|
|||
|
||||
msg_set_session(l_ptr->pmsg, msg_session(l_ptr->pmsg) + 1);
|
||||
|
||||
/* Link is down, accept any session: */
|
||||
/* Link is down, accept any session: */
|
||||
l_ptr->peer_session = 0;
|
||||
|
||||
/* Prepare for max packet size negotiation */
|
||||
/* Prepare for max packet size negotiation */
|
||||
link_init_max_pkt(l_ptr);
|
||||
|
||||
l_ptr->state = RESET_UNKNOWN;
|
||||
|
@ -2053,7 +2053,7 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
|
|||
{
|
||||
struct sk_buff *buf = NULL;
|
||||
struct tipc_msg *msg = l_ptr->pmsg;
|
||||
u32 msg_size = sizeof(l_ptr->proto_msg);
|
||||
u32 msg_size = sizeof(l_ptr->proto_msg);
|
||||
|
||||
if (link_blocked(l_ptr))
|
||||
return;
|
||||
|
@ -2085,20 +2085,20 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
|
|||
if (probe_msg) {
|
||||
u32 mtu = l_ptr->max_pkt;
|
||||
|
||||
if ((mtu < l_ptr->max_pkt_target) &&
|
||||
if ((mtu < l_ptr->max_pkt_target) &&
|
||||
link_working_working(l_ptr) &&
|
||||
l_ptr->fsm_msg_cnt) {
|
||||
msg_size = (mtu + (l_ptr->max_pkt_target - mtu)/2 + 2) & ~3;
|
||||
if (l_ptr->max_pkt_probes == 10) {
|
||||
l_ptr->max_pkt_target = (msg_size - 4);
|
||||
l_ptr->max_pkt_probes = 0;
|
||||
if (l_ptr->max_pkt_probes == 10) {
|
||||
l_ptr->max_pkt_target = (msg_size - 4);
|
||||
l_ptr->max_pkt_probes = 0;
|
||||
msg_size = (mtu + (l_ptr->max_pkt_target - mtu)/2 + 2) & ~3;
|
||||
}
|
||||
}
|
||||
l_ptr->max_pkt_probes++;
|
||||
}
|
||||
}
|
||||
|
||||
l_ptr->stats.sent_probes++;
|
||||
}
|
||||
}
|
||||
l_ptr->stats.sent_states++;
|
||||
} else { /* RESET_MSG or ACTIVATE_MSG */
|
||||
msg_set_ack(msg, mod(l_ptr->reset_checkpoint - 1));
|
||||
|
@ -2144,7 +2144,7 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg,
|
|||
return;
|
||||
|
||||
memcpy(buf->data, (unchar *)msg, sizeof(l_ptr->proto_msg));
|
||||
msg_set_size(buf_msg(buf), msg_size);
|
||||
msg_set_size(buf_msg(buf), msg_size);
|
||||
|
||||
if (tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr)) {
|
||||
l_ptr->unacked_window = 0;
|
||||
|
@ -2168,7 +2168,7 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
|
|||
{
|
||||
u32 rec_gap = 0;
|
||||
u32 max_pkt_info;
|
||||
u32 max_pkt_ack;
|
||||
u32 max_pkt_ack;
|
||||
u32 msg_tol;
|
||||
struct tipc_msg *msg = buf_msg(buf);
|
||||
|
||||
|
@ -2211,13 +2211,13 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
|
|||
l_ptr->priority = msg_linkprio(msg);
|
||||
|
||||
max_pkt_info = msg_max_pkt(msg);
|
||||
if (max_pkt_info) {
|
||||
if (max_pkt_info) {
|
||||
if (max_pkt_info < l_ptr->max_pkt_target)
|
||||
l_ptr->max_pkt_target = max_pkt_info;
|
||||
if (l_ptr->max_pkt > l_ptr->max_pkt_target)
|
||||
l_ptr->max_pkt = l_ptr->max_pkt_target;
|
||||
} else {
|
||||
l_ptr->max_pkt = l_ptr->max_pkt_target;
|
||||
l_ptr->max_pkt = l_ptr->max_pkt_target;
|
||||
}
|
||||
l_ptr->owner->bclink.supported = (max_pkt_info != 0);
|
||||
|
||||
|
@ -2255,20 +2255,20 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
|
|||
}
|
||||
|
||||
max_pkt_ack = msg_max_pkt(msg);
|
||||
if (max_pkt_ack > l_ptr->max_pkt) {
|
||||
dbg("Link <%s> updated MTU %u -> %u\n",
|
||||
l_ptr->name, l_ptr->max_pkt, max_pkt_ack);
|
||||
l_ptr->max_pkt = max_pkt_ack;
|
||||
l_ptr->max_pkt_probes = 0;
|
||||
}
|
||||
if (max_pkt_ack > l_ptr->max_pkt) {
|
||||
dbg("Link <%s> updated MTU %u -> %u\n",
|
||||
l_ptr->name, l_ptr->max_pkt, max_pkt_ack);
|
||||
l_ptr->max_pkt = max_pkt_ack;
|
||||
l_ptr->max_pkt_probes = 0;
|
||||
}
|
||||
|
||||
max_pkt_ack = 0;
|
||||
if (msg_probe(msg)) {
|
||||
if (msg_probe(msg)) {
|
||||
l_ptr->stats.recv_probes++;
|
||||
if (msg_size(msg) > sizeof(l_ptr->proto_msg)) {
|
||||
max_pkt_ack = msg_size(msg);
|
||||
}
|
||||
}
|
||||
if (msg_size(msg) > sizeof(l_ptr->proto_msg)) {
|
||||
max_pkt_ack = msg_size(msg);
|
||||
}
|
||||
}
|
||||
|
||||
/* Protocol message before retransmits, reduce loss risk */
|
||||
|
||||
|
@ -2884,10 +2884,10 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space
|
|||
u16 cmd)
|
||||
{
|
||||
struct tipc_link_config *args;
|
||||
u32 new_value;
|
||||
u32 new_value;
|
||||
struct link *l_ptr;
|
||||
struct node *node;
|
||||
int res;
|
||||
int res;
|
||||
|
||||
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_LINK_CONFIG))
|
||||
return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR);
|
||||
|
@ -2899,7 +2899,7 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space
|
|||
if ((cmd == TIPC_CMD_SET_LINK_WINDOW) &&
|
||||
(tipc_bclink_set_queue_limits(new_value) == 0))
|
||||
return tipc_cfg_reply_none();
|
||||
return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
|
||||
return tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
|
||||
" (cannot change setting on broadcast link)");
|
||||
}
|
||||
|
||||
|
@ -2907,7 +2907,7 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space
|
|||
l_ptr = link_find_link(args->name, &node);
|
||||
if (!l_ptr) {
|
||||
read_unlock_bh(&tipc_net_lock);
|
||||
return tipc_cfg_reply_error_string("link not found");
|
||||
return tipc_cfg_reply_error_string("link not found");
|
||||
}
|
||||
|
||||
tipc_node_lock(node);
|
||||
|
@ -2943,7 +2943,7 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space
|
|||
|
||||
read_unlock_bh(&tipc_net_lock);
|
||||
if (res)
|
||||
return tipc_cfg_reply_error_string("cannot change link setting");
|
||||
return tipc_cfg_reply_error_string("cannot change link setting");
|
||||
|
||||
return tipc_cfg_reply_none();
|
||||
}
|
||||
|
@ -3036,8 +3036,8 @@ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size)
|
|||
else
|
||||
status = "DEFUNCT";
|
||||
tipc_printf(&pb, "Link <%s>\n"
|
||||
" %s MTU:%u Priority:%u Tolerance:%u ms"
|
||||
" Window:%u packets\n",
|
||||
" %s MTU:%u Priority:%u Tolerance:%u ms"
|
||||
" Window:%u packets\n",
|
||||
l_ptr->name, status, link_max_pkt(l_ptr),
|
||||
l_ptr->priority, l_ptr->tolerance, l_ptr->queue_limit[0]);
|
||||
tipc_printf(&pb, " RX packets:%u fragments:%u/%u bundles:%u/%u\n",
|
||||
|
@ -3056,8 +3056,8 @@ static int tipc_link_stats(const char *name, char *buf, const u32 buf_size)
|
|||
if (!profile_total)
|
||||
profile_total = 1;
|
||||
tipc_printf(&pb, " TX profile sample:%u packets average:%u octets\n"
|
||||
" 0-64:%u%% -256:%u%% -1024:%u%% -4096:%u%% "
|
||||
"-16354:%u%% -32768:%u%% -66000:%u%%\n",
|
||||
" 0-64:%u%% -256:%u%% -1024:%u%% -4096:%u%% "
|
||||
"-16354:%u%% -32768:%u%% -66000:%u%%\n",
|
||||
l_ptr->stats.msg_length_counts,
|
||||
l_ptr->stats.msg_lengths_total / profile_total,
|
||||
percent(l_ptr->stats.msg_length_profile[0], profile_total),
|
||||
|
@ -3113,7 +3113,7 @@ struct sk_buff *tipc_link_cmd_show_stats(const void *req_tlv_area, int req_tlv_s
|
|||
(char *)TLV_DATA(rep_tlv), MAX_LINK_STATS_INFO);
|
||||
if (!str_len) {
|
||||
buf_discard(buf);
|
||||
return tipc_cfg_reply_error_string("link not found");
|
||||
return tipc_cfg_reply_error_string("link not found");
|
||||
}
|
||||
|
||||
skb_put(buf, TLV_SPACE(str_len));
|
||||
|
|
|
@ -143,18 +143,18 @@ struct link {
|
|||
u32 exp_msg_count;
|
||||
u32 reset_checkpoint;
|
||||
|
||||
/* Max packet negotiation */
|
||||
u32 max_pkt;
|
||||
u32 max_pkt_target;
|
||||
u32 max_pkt_probes;
|
||||
/* Max packet negotiation */
|
||||
u32 max_pkt;
|
||||
u32 max_pkt_target;
|
||||
u32 max_pkt_probes;
|
||||
|
||||
/* Sending */
|
||||
u32 out_queue_size;
|
||||
struct sk_buff *first_out;
|
||||
struct sk_buff *last_out;
|
||||
u32 next_out_no;
|
||||
u32 last_retransmitted;
|
||||
u32 stale_count;
|
||||
u32 last_retransmitted;
|
||||
u32 stale_count;
|
||||
|
||||
/* Reception */
|
||||
u32 next_in_no;
|
||||
|
@ -174,7 +174,7 @@ struct link {
|
|||
u32 long_msg_seq_no;
|
||||
struct sk_buff *defragm_buf;
|
||||
|
||||
/* Statistics */
|
||||
/* Statistics */
|
||||
struct {
|
||||
u32 sent_info; /* used in counting # sent packets */
|
||||
u32 recv_info; /* used in counting # recv'd packets */
|
||||
|
|
|
@ -221,15 +221,15 @@ static void node_is_down(struct publication *publ)
|
|||
{
|
||||
struct publication *p;
|
||||
|
||||
write_lock_bh(&tipc_nametbl_lock);
|
||||
write_lock_bh(&tipc_nametbl_lock);
|
||||
dbg("node_is_down: withdrawing %u, %u, %u\n",
|
||||
publ->type, publ->lower, publ->upper);
|
||||
publ->key += 1222345;
|
||||
publ->key += 1222345;
|
||||
p = tipc_nametbl_remove_publ(publ->type, publ->lower,
|
||||
publ->node, publ->ref, publ->key);
|
||||
write_unlock_bh(&tipc_nametbl_lock);
|
||||
|
||||
if (p != publ) {
|
||||
if (p != publ) {
|
||||
err("Unable to remove publication from failed node\n"
|
||||
"(type=%u, lower=%u, node=0x%x, ref=%u, key=%u)\n",
|
||||
publ->type, publ->lower, publ->node, publ->ref, publ->key);
|
||||
|
@ -282,7 +282,7 @@ void tipc_named_recv(struct sk_buff *buf)
|
|||
|
||||
if (publ) {
|
||||
tipc_nodesub_unsubscribe(&publ->subscr);
|
||||
kfree(publ);
|
||||
kfree(publ);
|
||||
} else {
|
||||
err("Unable to remove publication by node 0x%x\n"
|
||||
"(type=%u, lower=%u, ref=%u, key=%u)\n",
|
||||
|
|
|
@ -808,22 +808,22 @@ void tipc_nametbl_subscribe(struct subscription *s)
|
|||
u32 type = s->seq.type;
|
||||
struct name_seq *seq;
|
||||
|
||||
write_lock_bh(&tipc_nametbl_lock);
|
||||
write_lock_bh(&tipc_nametbl_lock);
|
||||
seq = nametbl_find_seq(type);
|
||||
if (!seq) {
|
||||
seq = tipc_nameseq_create(type, &table.types[hash(type)]);
|
||||
}
|
||||
if (seq){
|
||||
spin_lock_bh(&seq->lock);
|
||||
dbg("tipc_nametbl_subscribe:found %p for {%u,%u,%u}\n",
|
||||
seq, type, s->seq.lower, s->seq.upper);
|
||||
tipc_nameseq_subscribe(seq, s);
|
||||
spin_unlock_bh(&seq->lock);
|
||||
} else {
|
||||
if (seq){
|
||||
spin_lock_bh(&seq->lock);
|
||||
dbg("tipc_nametbl_subscribe:found %p for {%u,%u,%u}\n",
|
||||
seq, type, s->seq.lower, s->seq.upper);
|
||||
tipc_nameseq_subscribe(seq, s);
|
||||
spin_unlock_bh(&seq->lock);
|
||||
} else {
|
||||
warn("Failed to create subscription for {%u,%u,%u}\n",
|
||||
s->seq.type, s->seq.lower, s->seq.upper);
|
||||
}
|
||||
write_unlock_bh(&tipc_nametbl_lock);
|
||||
}
|
||||
write_unlock_bh(&tipc_nametbl_lock);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -834,19 +834,19 @@ void tipc_nametbl_unsubscribe(struct subscription *s)
|
|||
{
|
||||
struct name_seq *seq;
|
||||
|
||||
write_lock_bh(&tipc_nametbl_lock);
|
||||
seq = nametbl_find_seq(s->seq.type);
|
||||
write_lock_bh(&tipc_nametbl_lock);
|
||||
seq = nametbl_find_seq(s->seq.type);
|
||||
if (seq != NULL){
|
||||
spin_lock_bh(&seq->lock);
|
||||
list_del_init(&s->nameseq_list);
|
||||
spin_unlock_bh(&seq->lock);
|
||||
if ((seq->first_free == 0) && list_empty(&seq->subscriptions)) {
|
||||
hlist_del_init(&seq->ns_list);
|
||||
kfree(seq->sseqs);
|
||||
kfree(seq);
|
||||
}
|
||||
}
|
||||
write_unlock_bh(&tipc_nametbl_lock);
|
||||
spin_lock_bh(&seq->lock);
|
||||
list_del_init(&s->nameseq_list);
|
||||
spin_unlock_bh(&seq->lock);
|
||||
if ((seq->first_free == 0) && list_empty(&seq->subscriptions)) {
|
||||
hlist_del_init(&seq->ns_list);
|
||||
kfree(seq->sseqs);
|
||||
kfree(seq);
|
||||
}
|
||||
}
|
||||
write_unlock_bh(&tipc_nametbl_lock);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -284,7 +284,7 @@ int tipc_net_start(void)
|
|||
(res = tipc_bclink_init())) {
|
||||
return res;
|
||||
}
|
||||
tipc_subscr_stop();
|
||||
tipc_subscr_stop();
|
||||
tipc_cfg_stop();
|
||||
tipc_k_signal((Handler)tipc_subscr_start, 0);
|
||||
tipc_k_signal((Handler)tipc_cfg_init, 0);
|
||||
|
@ -298,12 +298,12 @@ void tipc_net_stop(void)
|
|||
{
|
||||
if (tipc_mode != TIPC_NET_MODE)
|
||||
return;
|
||||
write_lock_bh(&tipc_net_lock);
|
||||
write_lock_bh(&tipc_net_lock);
|
||||
tipc_bearer_stop();
|
||||
tipc_mode = TIPC_NODE_MODE;
|
||||
tipc_bclink_stop();
|
||||
net_stop();
|
||||
write_unlock_bh(&tipc_net_lock);
|
||||
write_unlock_bh(&tipc_net_lock);
|
||||
info("Left network mode \n");
|
||||
}
|
||||
|
||||
|
|
|
@ -63,15 +63,15 @@ static int handle_cmd(struct sk_buff *skb, struct genl_info *info)
|
|||
genlmsg_unicast(rep_buf, req_nlh->nlmsg_pid);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct genl_family family = {
|
||||
.id = GENL_ID_GENERATE,
|
||||
.name = TIPC_GENL_NAME,
|
||||
.version = TIPC_GENL_VERSION,
|
||||
.hdrsize = TIPC_GENL_HDRLEN,
|
||||
.maxattr = 0,
|
||||
.id = GENL_ID_GENERATE,
|
||||
.name = TIPC_GENL_NAME,
|
||||
.version = TIPC_GENL_VERSION,
|
||||
.hdrsize = TIPC_GENL_HDRLEN,
|
||||
.maxattr = 0,
|
||||
};
|
||||
|
||||
static struct genl_ops ops = {
|
||||
|
@ -93,7 +93,7 @@ int tipc_netlink_start(void)
|
|||
if (genl_register_ops(&family, &ops))
|
||||
goto err_unregister;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
err_unregister:
|
||||
genl_unregister_family(&family);
|
||||
|
|
134
net/tipc/node.c
134
net/tipc/node.c
|
@ -58,7 +58,7 @@ struct node *tipc_node_create(u32 addr)
|
|||
{
|
||||
struct cluster *c_ptr;
|
||||
struct node *n_ptr;
|
||||
struct node **curr_node;
|
||||
struct node **curr_node;
|
||||
|
||||
n_ptr = kzalloc(sizeof(*n_ptr),GFP_ATOMIC);
|
||||
if (!n_ptr) {
|
||||
|
@ -76,7 +76,7 @@ struct node *tipc_node_create(u32 addr)
|
|||
}
|
||||
|
||||
n_ptr->addr = addr;
|
||||
spin_lock_init(&n_ptr->lock);
|
||||
spin_lock_init(&n_ptr->lock);
|
||||
INIT_LIST_HEAD(&n_ptr->nsub);
|
||||
n_ptr->owner = c_ptr;
|
||||
tipc_cltr_attach_node(c_ptr, n_ptr);
|
||||
|
@ -160,17 +160,17 @@ static void node_select_active_links(struct node *n_ptr)
|
|||
u32 i;
|
||||
u32 highest_prio = 0;
|
||||
|
||||
active[0] = active[1] = NULL;
|
||||
active[0] = active[1] = NULL;
|
||||
|
||||
for (i = 0; i < MAX_BEARERS; i++) {
|
||||
struct link *l_ptr = n_ptr->links[i];
|
||||
struct link *l_ptr = n_ptr->links[i];
|
||||
|
||||
if (!l_ptr || !tipc_link_is_up(l_ptr) ||
|
||||
(l_ptr->priority < highest_prio))
|
||||
continue;
|
||||
|
||||
if (l_ptr->priority > highest_prio) {
|
||||
highest_prio = l_ptr->priority;
|
||||
highest_prio = l_ptr->priority;
|
||||
active[0] = active[1] = l_ptr;
|
||||
} else {
|
||||
active[1] = l_ptr;
|
||||
|
@ -236,28 +236,28 @@ struct node *tipc_node_attach_link(struct link *l_ptr)
|
|||
|
||||
if (!n_ptr)
|
||||
n_ptr = tipc_node_create(l_ptr->addr);
|
||||
if (n_ptr) {
|
||||
if (n_ptr) {
|
||||
u32 bearer_id = l_ptr->b_ptr->identity;
|
||||
char addr_string[16];
|
||||
|
||||
if (n_ptr->link_cnt >= 2) {
|
||||
if (n_ptr->link_cnt >= 2) {
|
||||
char addr_string[16];
|
||||
|
||||
err("Attempt to create third link to %s\n",
|
||||
err("Attempt to create third link to %s\n",
|
||||
addr_string_fill(addr_string, n_ptr->addr));
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!n_ptr->links[bearer_id]) {
|
||||
n_ptr->links[bearer_id] = l_ptr;
|
||||
tipc_net.zones[tipc_zone(l_ptr->addr)]->links++;
|
||||
n_ptr->link_cnt++;
|
||||
return n_ptr;
|
||||
}
|
||||
err("Attempt to establish second link on <%s> to %s \n",
|
||||
l_ptr->b_ptr->publ.name,
|
||||
if (!n_ptr->links[bearer_id]) {
|
||||
n_ptr->links[bearer_id] = l_ptr;
|
||||
tipc_net.zones[tipc_zone(l_ptr->addr)]->links++;
|
||||
n_ptr->link_cnt++;
|
||||
return n_ptr;
|
||||
}
|
||||
err("Attempt to establish second link on <%s> to %s \n",
|
||||
l_ptr->b_ptr->publ.name,
|
||||
addr_string_fill(addr_string, l_ptr->addr));
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -323,8 +323,8 @@ static void node_established_contact(struct node *n_ptr)
|
|||
tipc_k_signal((Handler)tipc_named_node_up, n_ptr->addr);
|
||||
}
|
||||
|
||||
/* Syncronize broadcast acks */
|
||||
n_ptr->bclink.acked = tipc_bclink_get_last_sent();
|
||||
/* Syncronize broadcast acks */
|
||||
n_ptr->bclink.acked = tipc_bclink_get_last_sent();
|
||||
|
||||
if (is_slave(tipc_own_addr))
|
||||
return;
|
||||
|
@ -333,8 +333,8 @@ static void node_established_contact(struct node *n_ptr)
|
|||
c_ptr = tipc_cltr_find(tipc_own_addr);
|
||||
if (!c_ptr)
|
||||
c_ptr = tipc_cltr_create(tipc_own_addr);
|
||||
if (c_ptr)
|
||||
tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1,
|
||||
if (c_ptr)
|
||||
tipc_cltr_bcast_new_route(c_ptr, n_ptr->addr, 1,
|
||||
tipc_max_nodes);
|
||||
return;
|
||||
}
|
||||
|
@ -367,22 +367,22 @@ static void node_lost_contact(struct node *n_ptr)
|
|||
char addr_string[16];
|
||||
u32 i;
|
||||
|
||||
/* Clean up broadcast reception remains */
|
||||
n_ptr->bclink.gap_after = n_ptr->bclink.gap_to = 0;
|
||||
while (n_ptr->bclink.deferred_head) {
|
||||
struct sk_buff* buf = n_ptr->bclink.deferred_head;
|
||||
n_ptr->bclink.deferred_head = buf->next;
|
||||
buf_discard(buf);
|
||||
}
|
||||
if (n_ptr->bclink.defragm) {
|
||||
buf_discard(n_ptr->bclink.defragm);
|
||||
n_ptr->bclink.defragm = NULL;
|
||||
}
|
||||
if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) {
|
||||
tipc_bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000));
|
||||
}
|
||||
/* Clean up broadcast reception remains */
|
||||
n_ptr->bclink.gap_after = n_ptr->bclink.gap_to = 0;
|
||||
while (n_ptr->bclink.deferred_head) {
|
||||
struct sk_buff* buf = n_ptr->bclink.deferred_head;
|
||||
n_ptr->bclink.deferred_head = buf->next;
|
||||
buf_discard(buf);
|
||||
}
|
||||
if (n_ptr->bclink.defragm) {
|
||||
buf_discard(n_ptr->bclink.defragm);
|
||||
n_ptr->bclink.defragm = NULL;
|
||||
}
|
||||
if (in_own_cluster(n_ptr->addr) && n_ptr->bclink.supported) {
|
||||
tipc_bclink_acknowledge(n_ptr, mod(n_ptr->bclink.acked + 10000));
|
||||
}
|
||||
|
||||
/* Update routing tables */
|
||||
/* Update routing tables */
|
||||
if (is_slave(tipc_own_addr)) {
|
||||
tipc_net_remove_as_router(n_ptr->addr);
|
||||
} else {
|
||||
|
@ -429,7 +429,7 @@ static void node_lost_contact(struct node *n_ptr)
|
|||
|
||||
/* Notify subscribers */
|
||||
list_for_each_entry_safe(ns, tns, &n_ptr->nsub, nodesub_list) {
|
||||
ns->node = NULL;
|
||||
ns->node = NULL;
|
||||
list_del_init(&ns->nodesub_list);
|
||||
tipc_k_signal((Handler)ns->handle_node_down,
|
||||
(unsigned long)ns->usr_handle);
|
||||
|
@ -447,13 +447,13 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector)
|
|||
struct node *n_ptr;
|
||||
u32 router_addr;
|
||||
|
||||
if (!tipc_addr_domain_valid(addr))
|
||||
return NULL;
|
||||
if (!tipc_addr_domain_valid(addr))
|
||||
return NULL;
|
||||
|
||||
/* Look for direct link to destination processsor */
|
||||
n_ptr = tipc_node_find(addr);
|
||||
if (n_ptr && tipc_node_has_active_links(n_ptr))
|
||||
return n_ptr;
|
||||
return n_ptr;
|
||||
|
||||
/* Cluster local system nodes *must* have direct links */
|
||||
if (!is_slave(addr) && in_own_cluster(addr))
|
||||
|
@ -462,7 +462,7 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector)
|
|||
/* Look for cluster local router with direct link to node */
|
||||
router_addr = tipc_node_select_router(n_ptr, selector);
|
||||
if (router_addr)
|
||||
return tipc_node_select(router_addr, selector);
|
||||
return tipc_node_select(router_addr, selector);
|
||||
|
||||
/* Slave nodes can only be accessed within own cluster via a
|
||||
known router with direct link -- if no router was found,give up */
|
||||
|
@ -473,14 +473,14 @@ struct node *tipc_node_select_next_hop(u32 addr, u32 selector)
|
|||
addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0);
|
||||
n_ptr = tipc_net_select_remote_node(addr, selector);
|
||||
if (n_ptr && tipc_node_has_active_links(n_ptr))
|
||||
return n_ptr;
|
||||
return n_ptr;
|
||||
|
||||
/* Last resort -- look for any router to anywhere in remote zone */
|
||||
router_addr = tipc_net_select_router(addr, selector);
|
||||
if (router_addr)
|
||||
return tipc_node_select(router_addr, selector);
|
||||
return tipc_node_select(router_addr, selector);
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -496,8 +496,8 @@ u32 tipc_node_select_router(struct node *n_ptr, u32 ref)
|
|||
u32 start;
|
||||
u32 r;
|
||||
|
||||
if (!n_ptr)
|
||||
return 0;
|
||||
if (!n_ptr)
|
||||
return 0;
|
||||
|
||||
if (n_ptr->last_router < 0)
|
||||
return 0;
|
||||
|
@ -590,7 +590,7 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
|
|||
u32 domain;
|
||||
struct sk_buff *buf;
|
||||
struct node *n_ptr;
|
||||
struct tipc_node_info node_info;
|
||||
struct tipc_node_info node_info;
|
||||
u32 payload_size;
|
||||
|
||||
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
|
||||
|
@ -601,8 +601,8 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
|
|||
return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
|
||||
" (network address)");
|
||||
|
||||
if (!tipc_nodes)
|
||||
return tipc_cfg_reply_none();
|
||||
if (!tipc_nodes)
|
||||
return tipc_cfg_reply_none();
|
||||
|
||||
/* For now, get space for all other nodes
|
||||
(will need to modify this when slave nodes are supported */
|
||||
|
@ -620,8 +620,8 @@ struct sk_buff *tipc_node_get_nodes(const void *req_tlv_area, int req_tlv_space)
|
|||
for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
|
||||
if (!in_scope(domain, n_ptr->addr))
|
||||
continue;
|
||||
node_info.addr = htonl(n_ptr->addr);
|
||||
node_info.up = htonl(tipc_node_is_up(n_ptr));
|
||||
node_info.addr = htonl(n_ptr->addr);
|
||||
node_info.up = htonl(tipc_node_is_up(n_ptr));
|
||||
tipc_cfg_append_tlv(buf, TIPC_TLV_NODE_INFO,
|
||||
&node_info, sizeof(node_info));
|
||||
}
|
||||
|
@ -634,7 +634,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
|
|||
u32 domain;
|
||||
struct sk_buff *buf;
|
||||
struct node *n_ptr;
|
||||
struct tipc_link_info link_info;
|
||||
struct tipc_link_info link_info;
|
||||
u32 payload_size;
|
||||
|
||||
if (!TLV_CHECK(req_tlv_area, req_tlv_space, TIPC_TLV_NET_ADDR))
|
||||
|
@ -645,8 +645,8 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
|
|||
return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE
|
||||
" (network address)");
|
||||
|
||||
if (tipc_mode != TIPC_NET_MODE)
|
||||
return tipc_cfg_reply_none();
|
||||
if (tipc_mode != TIPC_NET_MODE)
|
||||
return tipc_cfg_reply_none();
|
||||
|
||||
/* Get space for all unicast links + multicast link */
|
||||
|
||||
|
@ -661,27 +661,27 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
|
|||
|
||||
/* Add TLV for broadcast link */
|
||||
|
||||
link_info.dest = htonl(tipc_own_addr & 0xfffff00);
|
||||
link_info.up = htonl(1);
|
||||
sprintf(link_info.str, tipc_bclink_name);
|
||||
link_info.dest = htonl(tipc_own_addr & 0xfffff00);
|
||||
link_info.up = htonl(1);
|
||||
sprintf(link_info.str, tipc_bclink_name);
|
||||
tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info));
|
||||
|
||||
/* Add TLVs for any other links in scope */
|
||||
|
||||
for (n_ptr = tipc_nodes; n_ptr; n_ptr = n_ptr->next) {
|
||||
u32 i;
|
||||
u32 i;
|
||||
|
||||
if (!in_scope(domain, n_ptr->addr))
|
||||
continue;
|
||||
for (i = 0; i < MAX_BEARERS; i++) {
|
||||
if (!n_ptr->links[i])
|
||||
continue;
|
||||
link_info.dest = htonl(n_ptr->addr);
|
||||
link_info.up = htonl(tipc_link_is_up(n_ptr->links[i]));
|
||||
strcpy(link_info.str, n_ptr->links[i]->name);
|
||||
for (i = 0; i < MAX_BEARERS; i++) {
|
||||
if (!n_ptr->links[i])
|
||||
continue;
|
||||
link_info.dest = htonl(n_ptr->addr);
|
||||
link_info.up = htonl(tipc_link_is_up(n_ptr->links[i]));
|
||||
strcpy(link_info.str, n_ptr->links[i]->name);
|
||||
tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO,
|
||||
&link_info, sizeof(link_info));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return buf;
|
||||
|
|
|
@ -665,39 +665,39 @@ exit:
|
|||
|
||||
static void port_print(struct port *p_ptr, struct print_buf *buf, int full_id)
|
||||
{
|
||||
struct publication *publ;
|
||||
struct publication *publ;
|
||||
|
||||
if (full_id)
|
||||
tipc_printf(buf, "<%u.%u.%u:%u>:",
|
||||
tipc_zone(tipc_own_addr), tipc_cluster(tipc_own_addr),
|
||||
tipc_node(tipc_own_addr), p_ptr->publ.ref);
|
||||
tipc_node(tipc_own_addr), p_ptr->publ.ref);
|
||||
else
|
||||
tipc_printf(buf, "%-10u:", p_ptr->publ.ref);
|
||||
|
||||
if (p_ptr->publ.connected) {
|
||||
u32 dport = port_peerport(p_ptr);
|
||||
u32 destnode = port_peernode(p_ptr);
|
||||
if (p_ptr->publ.connected) {
|
||||
u32 dport = port_peerport(p_ptr);
|
||||
u32 destnode = port_peernode(p_ptr);
|
||||
|
||||
tipc_printf(buf, " connected to <%u.%u.%u:%u>",
|
||||
tipc_zone(destnode), tipc_cluster(destnode),
|
||||
tipc_node(destnode), dport);
|
||||
if (p_ptr->publ.conn_type != 0)
|
||||
tipc_printf(buf, " via {%u,%u}",
|
||||
p_ptr->publ.conn_type,
|
||||
p_ptr->publ.conn_instance);
|
||||
}
|
||||
else if (p_ptr->publ.published) {
|
||||
tipc_printf(buf, " bound to");
|
||||
list_for_each_entry(publ, &p_ptr->publications, pport_list) {
|
||||
tipc_printf(buf, " connected to <%u.%u.%u:%u>",
|
||||
tipc_zone(destnode), tipc_cluster(destnode),
|
||||
tipc_node(destnode), dport);
|
||||
if (p_ptr->publ.conn_type != 0)
|
||||
tipc_printf(buf, " via {%u,%u}",
|
||||
p_ptr->publ.conn_type,
|
||||
p_ptr->publ.conn_instance);
|
||||
}
|
||||
else if (p_ptr->publ.published) {
|
||||
tipc_printf(buf, " bound to");
|
||||
list_for_each_entry(publ, &p_ptr->publications, pport_list) {
|
||||
if (publ->lower == publ->upper)
|
||||
tipc_printf(buf, " {%u,%u}", publ->type,
|
||||
publ->lower);
|
||||
else
|
||||
tipc_printf(buf, " {%u,%u,%u}", publ->type,
|
||||
publ->lower, publ->upper);
|
||||
}
|
||||
}
|
||||
tipc_printf(buf, "\n");
|
||||
}
|
||||
}
|
||||
tipc_printf(buf, "\n");
|
||||
}
|
||||
|
||||
#define MAX_PORT_QUERY 32768
|
||||
|
|
|
@ -148,8 +148,8 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock)
|
|||
reference = (next_plus_upper & ~index_mask) + index;
|
||||
entry->data.reference = reference;
|
||||
entry->object = object;
|
||||
if (lock != 0)
|
||||
*lock = &entry->lock;
|
||||
if (lock != 0)
|
||||
*lock = &entry->lock;
|
||||
spin_unlock_bh(&entry->lock);
|
||||
}
|
||||
write_unlock_bh(&ref_table_lock);
|
||||
|
|
|
@ -90,7 +90,7 @@ static atomic_t tipc_queue_size = ATOMIC_INIT(0);
|
|||
*/
|
||||
static void sock_lock(struct tipc_sock* tsock)
|
||||
{
|
||||
spin_lock_bh(tsock->p->lock);
|
||||
spin_lock_bh(tsock->p->lock);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -98,7 +98,7 @@ static void sock_lock(struct tipc_sock* tsock)
|
|||
*/
|
||||
static void sock_unlock(struct tipc_sock* tsock)
|
||||
{
|
||||
spin_unlock_bh(tsock->p->lock);
|
||||
spin_unlock_bh(tsock->p->lock);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -146,9 +146,9 @@ static u32 pollmask(struct socket *sock)
|
|||
|
||||
static void advance_queue(struct tipc_sock *tsock)
|
||||
{
|
||||
sock_lock(tsock);
|
||||
sock_lock(tsock);
|
||||
buf_discard(skb_dequeue(&tsock->sk.sk_receive_queue));
|
||||
sock_unlock(tsock);
|
||||
sock_unlock(tsock);
|
||||
atomic_dec(&tipc_queue_size);
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ static int tipc_create(struct socket *sock, int protocol)
|
|||
struct tipc_sock *tsock;
|
||||
struct tipc_port *port;
|
||||
struct sock *sk;
|
||||
u32 ref;
|
||||
u32 ref;
|
||||
|
||||
if (unlikely(protocol != 0))
|
||||
return -EPROTONOSUPPORT;
|
||||
|
@ -247,7 +247,7 @@ static int release(struct socket *sock)
|
|||
int res = TIPC_OK;
|
||||
struct sk_buff *buf;
|
||||
|
||||
dbg("sock_delete: %x\n",tsock);
|
||||
dbg("sock_delete: %x\n",tsock);
|
||||
if (!tsock)
|
||||
return 0;
|
||||
down_interruptible(&tsock->sem);
|
||||
|
@ -289,7 +289,7 @@ static int release(struct socket *sock)
|
|||
|
||||
sock_put(sk);
|
||||
|
||||
atomic_dec(&tipc_user_count);
|
||||
atomic_dec(&tipc_user_count);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -336,7 +336,7 @@ static int bind(struct socket *sock, struct sockaddr *uaddr, int uaddr_len)
|
|||
goto exit;
|
||||
}
|
||||
|
||||
if (addr->scope > 0)
|
||||
if (addr->scope > 0)
|
||||
res = tipc_publish(tsock->p->ref, addr->scope,
|
||||
&addr->addr.nameseq);
|
||||
else
|
||||
|
@ -413,15 +413,15 @@ static int dest_name_check(struct sockaddr_tipc *dest, struct msghdr *m)
|
|||
{
|
||||
struct tipc_cfg_msg_hdr hdr;
|
||||
|
||||
if (likely(dest->addr.name.name.type >= TIPC_RESERVED_TYPES))
|
||||
return 0;
|
||||
if (likely(dest->addr.name.name.type == TIPC_TOP_SRV))
|
||||
return 0;
|
||||
if (likely(dest->addr.name.name.type >= TIPC_RESERVED_TYPES))
|
||||
return 0;
|
||||
if (likely(dest->addr.name.name.type == TIPC_TOP_SRV))
|
||||
return 0;
|
||||
|
||||
if (likely(dest->addr.name.name.type != TIPC_CFG_SRV))
|
||||
return -EACCES;
|
||||
if (likely(dest->addr.name.name.type != TIPC_CFG_SRV))
|
||||
return -EACCES;
|
||||
|
||||
if (copy_from_user(&hdr, m->msg_iov[0].iov_base, sizeof(hdr)))
|
||||
if (copy_from_user(&hdr, m->msg_iov[0].iov_base, sizeof(hdr)))
|
||||
return -EFAULT;
|
||||
if ((ntohs(hdr.tcm_type) & 0xC000) && (!capable(CAP_NET_ADMIN)))
|
||||
return -EACCES;
|
||||
|
@ -448,7 +448,7 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,
|
|||
struct msghdr *m, size_t total_len)
|
||||
{
|
||||
struct tipc_sock *tsock = tipc_sk(sock->sk);
|
||||
struct sockaddr_tipc *dest = (struct sockaddr_tipc *)m->msg_name;
|
||||
struct sockaddr_tipc *dest = (struct sockaddr_tipc *)m->msg_name;
|
||||
struct sk_buff *buf;
|
||||
int needs_conn;
|
||||
int res = -EINVAL;
|
||||
|
@ -489,50 +489,50 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,
|
|||
sock->state = SS_CONNECTING;
|
||||
}
|
||||
|
||||
do {
|
||||
if (dest->addrtype == TIPC_ADDR_NAME) {
|
||||
if ((res = dest_name_check(dest, m)))
|
||||
goto exit;
|
||||
res = tipc_send2name(tsock->p->ref,
|
||||
&dest->addr.name.name,
|
||||
dest->addr.name.domain,
|
||||
m->msg_iovlen,
|
||||
m->msg_iov);
|
||||
}
|
||||
else if (dest->addrtype == TIPC_ADDR_ID) {
|
||||
res = tipc_send2port(tsock->p->ref,
|
||||
&dest->addr.id,
|
||||
m->msg_iovlen,
|
||||
m->msg_iov);
|
||||
}
|
||||
else if (dest->addrtype == TIPC_ADDR_MCAST) {
|
||||
do {
|
||||
if (dest->addrtype == TIPC_ADDR_NAME) {
|
||||
if ((res = dest_name_check(dest, m)))
|
||||
goto exit;
|
||||
res = tipc_send2name(tsock->p->ref,
|
||||
&dest->addr.name.name,
|
||||
dest->addr.name.domain,
|
||||
m->msg_iovlen,
|
||||
m->msg_iov);
|
||||
}
|
||||
else if (dest->addrtype == TIPC_ADDR_ID) {
|
||||
res = tipc_send2port(tsock->p->ref,
|
||||
&dest->addr.id,
|
||||
m->msg_iovlen,
|
||||
m->msg_iov);
|
||||
}
|
||||
else if (dest->addrtype == TIPC_ADDR_MCAST) {
|
||||
if (needs_conn) {
|
||||
res = -EOPNOTSUPP;
|
||||
goto exit;
|
||||
}
|
||||
if ((res = dest_name_check(dest, m)))
|
||||
goto exit;
|
||||
res = tipc_multicast(tsock->p->ref,
|
||||
&dest->addr.nameseq,
|
||||
0,
|
||||
m->msg_iovlen,
|
||||
m->msg_iov);
|
||||
}
|
||||
if (likely(res != -ELINKCONG)) {
|
||||
if ((res = dest_name_check(dest, m)))
|
||||
goto exit;
|
||||
res = tipc_multicast(tsock->p->ref,
|
||||
&dest->addr.nameseq,
|
||||
0,
|
||||
m->msg_iovlen,
|
||||
m->msg_iov);
|
||||
}
|
||||
if (likely(res != -ELINKCONG)) {
|
||||
exit:
|
||||
up(&tsock->sem);
|
||||
return res;
|
||||
}
|
||||
up(&tsock->sem);
|
||||
return res;
|
||||
}
|
||||
if (m->msg_flags & MSG_DONTWAIT) {
|
||||
res = -EWOULDBLOCK;
|
||||
goto exit;
|
||||
}
|
||||
if (wait_event_interruptible(*sock->sk->sk_sleep,
|
||||
!tsock->p->congested)) {
|
||||
res = -ERESTARTSYS;
|
||||
goto exit;
|
||||
}
|
||||
} while (1);
|
||||
if (wait_event_interruptible(*sock->sk->sk_sleep,
|
||||
!tsock->p->congested)) {
|
||||
res = -ERESTARTSYS;
|
||||
goto exit;
|
||||
}
|
||||
} while (1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -551,7 +551,7 @@ static int send_packet(struct kiocb *iocb, struct socket *sock,
|
|||
struct msghdr *m, size_t total_len)
|
||||
{
|
||||
struct tipc_sock *tsock = tipc_sk(sock->sk);
|
||||
struct sockaddr_tipc *dest = (struct sockaddr_tipc *)m->msg_name;
|
||||
struct sockaddr_tipc *dest = (struct sockaddr_tipc *)m->msg_name;
|
||||
int res;
|
||||
|
||||
/* Handle implied connection establishment */
|
||||
|
@ -561,9 +561,9 @@ static int send_packet(struct kiocb *iocb, struct socket *sock,
|
|||
|
||||
if (down_interruptible(&tsock->sem)) {
|
||||
return -ERESTARTSYS;
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
do {
|
||||
if (unlikely(sock->state != SS_CONNECTED)) {
|
||||
if (sock->state == SS_DISCONNECTING)
|
||||
res = -EPIPE;
|
||||
|
@ -572,22 +572,22 @@ static int send_packet(struct kiocb *iocb, struct socket *sock,
|
|||
goto exit;
|
||||
}
|
||||
|
||||
res = tipc_send(tsock->p->ref, m->msg_iovlen, m->msg_iov);
|
||||
if (likely(res != -ELINKCONG)) {
|
||||
res = tipc_send(tsock->p->ref, m->msg_iovlen, m->msg_iov);
|
||||
if (likely(res != -ELINKCONG)) {
|
||||
exit:
|
||||
up(&tsock->sem);
|
||||
return res;
|
||||
}
|
||||
up(&tsock->sem);
|
||||
return res;
|
||||
}
|
||||
if (m->msg_flags & MSG_DONTWAIT) {
|
||||
res = -EWOULDBLOCK;
|
||||
goto exit;
|
||||
}
|
||||
if (wait_event_interruptible(*sock->sk->sk_sleep,
|
||||
!tsock->p->congested)) {
|
||||
res = -ERESTARTSYS;
|
||||
goto exit;
|
||||
}
|
||||
} while (1);
|
||||
if (wait_event_interruptible(*sock->sk->sk_sleep,
|
||||
!tsock->p->congested)) {
|
||||
res = -ERESTARTSYS;
|
||||
goto exit;
|
||||
}
|
||||
} while (1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -622,12 +622,12 @@ static int send_stream(struct kiocb *iocb, struct socket *sock,
|
|||
|
||||
/* Can only send large data streams if already connected */
|
||||
|
||||
if (unlikely(sock->state != SS_CONNECTED)) {
|
||||
if (sock->state == SS_DISCONNECTING)
|
||||
return -EPIPE;
|
||||
else
|
||||
return -ENOTCONN;
|
||||
}
|
||||
if (unlikely(sock->state != SS_CONNECTED)) {
|
||||
if (sock->state == SS_DISCONNECTING)
|
||||
return -EPIPE;
|
||||
else
|
||||
return -ENOTCONN;
|
||||
}
|
||||
|
||||
if (unlikely(m->msg_name))
|
||||
return -EISCONN;
|
||||
|
@ -657,7 +657,7 @@ static int send_stream(struct kiocb *iocb, struct socket *sock,
|
|||
? curr_left : TIPC_MAX_USER_MSG_SIZE;
|
||||
my_iov.iov_base = curr_start;
|
||||
my_iov.iov_len = bytes_to_send;
|
||||
if ((res = send_packet(iocb, sock, &my_msg, 0)) < 0) {
|
||||
if ((res = send_packet(iocb, sock, &my_msg, 0)) < 0) {
|
||||
return bytes_sent ? bytes_sent : res;
|
||||
}
|
||||
curr_left -= bytes_to_send;
|
||||
|
@ -708,9 +708,9 @@ static int auto_connect(struct socket *sock, struct tipc_sock *tsock,
|
|||
|
||||
static void set_orig_addr(struct msghdr *m, struct tipc_msg *msg)
|
||||
{
|
||||
struct sockaddr_tipc *addr = (struct sockaddr_tipc *)m->msg_name;
|
||||
struct sockaddr_tipc *addr = (struct sockaddr_tipc *)m->msg_name;
|
||||
|
||||
if (addr) {
|
||||
if (addr) {
|
||||
addr->family = AF_TIPC;
|
||||
addr->addrtype = TIPC_ADDR_ID;
|
||||
addr->addr.id.ref = msg_origport(msg);
|
||||
|
@ -829,7 +829,7 @@ static int recv_msg(struct kiocb *iocb, struct socket *sock,
|
|||
return -ENOTCONN;
|
||||
if (unlikely((sock->state == SS_DISCONNECTING) &&
|
||||
(skb_queue_len(&sock->sk->sk_receive_queue) == 0)))
|
||||
return -ENOTCONN;
|
||||
return -ENOTCONN;
|
||||
}
|
||||
|
||||
/* Look for a message in receive queue; wait if necessary */
|
||||
|
@ -913,10 +913,10 @@ restart:
|
|||
/* Consume received message (optional) */
|
||||
|
||||
if (likely(!(flags & MSG_PEEK))) {
|
||||
if (unlikely(++tsock->p->conn_unacked >= TIPC_FLOW_CONTROL_WIN))
|
||||
tipc_acknowledge(tsock->p->ref, tsock->p->conn_unacked);
|
||||
if (unlikely(++tsock->p->conn_unacked >= TIPC_FLOW_CONTROL_WIN))
|
||||
tipc_acknowledge(tsock->p->ref, tsock->p->conn_unacked);
|
||||
advance_queue(tsock);
|
||||
}
|
||||
}
|
||||
exit:
|
||||
up(&tsock->sem);
|
||||
return res;
|
||||
|
@ -1050,10 +1050,10 @@ restart:
|
|||
/* Consume received message (optional) */
|
||||
|
||||
if (likely(!(flags & MSG_PEEK))) {
|
||||
if (unlikely(++tsock->p->conn_unacked >= TIPC_FLOW_CONTROL_WIN))
|
||||
tipc_acknowledge(tsock->p->ref, tsock->p->conn_unacked);
|
||||
if (unlikely(++tsock->p->conn_unacked >= TIPC_FLOW_CONTROL_WIN))
|
||||
tipc_acknowledge(tsock->p->ref, tsock->p->conn_unacked);
|
||||
advance_queue(tsock);
|
||||
}
|
||||
}
|
||||
|
||||
/* Loop around if more data is required */
|
||||
|
||||
|
@ -1185,13 +1185,13 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
|
|||
if (queue_overloaded(atomic_read(&tipc_queue_size),
|
||||
OVERLOAD_LIMIT_BASE, msg))
|
||||
return TIPC_ERR_OVERLOAD;
|
||||
}
|
||||
}
|
||||
recv_q_len = skb_queue_len(&tsock->sk.sk_receive_queue);
|
||||
if (unlikely(recv_q_len > (OVERLOAD_LIMIT_BASE / 2))) {
|
||||
if (queue_overloaded(recv_q_len,
|
||||
OVERLOAD_LIMIT_BASE / 2, msg))
|
||||
return TIPC_ERR_OVERLOAD;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initiate connection termination for an incoming 'FIN' */
|
||||
|
||||
|
@ -1260,7 +1260,7 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
|
|||
if (sock->state == SS_CONNECTING)
|
||||
return -EALREADY;
|
||||
if (sock->state != SS_UNCONNECTED)
|
||||
return -EISCONN;
|
||||
return -EISCONN;
|
||||
|
||||
/*
|
||||
* Reject connection attempt using multicast address
|
||||
|
@ -1270,7 +1270,7 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
|
|||
*/
|
||||
|
||||
if (dst->addrtype == TIPC_ADDR_MCAST)
|
||||
return -EINVAL;
|
||||
return -EINVAL;
|
||||
|
||||
/* Send a 'SYN-' to destination */
|
||||
|
||||
|
@ -1282,18 +1282,18 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
|
|||
}
|
||||
|
||||
if (down_interruptible(&tsock->sem))
|
||||
return -ERESTARTSYS;
|
||||
return -ERESTARTSYS;
|
||||
|
||||
/* Wait for destination's 'ACK' response */
|
||||
|
||||
res = wait_event_interruptible_timeout(*sock->sk->sk_sleep,
|
||||
skb_queue_len(&sock->sk->sk_receive_queue),
|
||||
skb_queue_len(&sock->sk->sk_receive_queue),
|
||||
sock->sk->sk_rcvtimeo);
|
||||
buf = skb_peek(&sock->sk->sk_receive_queue);
|
||||
if (res > 0) {
|
||||
msg = buf_msg(buf);
|
||||
res = auto_connect(sock, tsock, msg);
|
||||
if (!res) {
|
||||
res = auto_connect(sock, tsock, msg);
|
||||
if (!res) {
|
||||
if (!msg_data_sz(msg))
|
||||
advance_queue(tsock);
|
||||
}
|
||||
|
@ -1301,7 +1301,7 @@ static int connect(struct socket *sock, struct sockaddr *dest, int destlen,
|
|||
if (res == 0) {
|
||||
res = -ETIMEDOUT;
|
||||
} else
|
||||
{ /* leave "res" unchanged */ }
|
||||
{ /* leave "res" unchanged */ }
|
||||
sock->state = SS_DISCONNECTING;
|
||||
}
|
||||
|
||||
|
@ -1326,7 +1326,7 @@ static int listen(struct socket *sock, int len)
|
|||
if (sock->state != SS_UNCONNECTED)
|
||||
return -EINVAL;
|
||||
sock->state = SS_LISTENING;
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1381,18 +1381,18 @@ static int accept(struct socket *sock, struct socket *newsock, int flags)
|
|||
new_tsock->p->conn_instance = msg_nameinst(msg);
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Respond to 'SYN-' by discarding it & returning 'ACK'-.
|
||||
* Respond to 'SYN+' by queuing it on new socket.
|
||||
*/
|
||||
|
||||
msg_dbg(msg,"<ACC<: ");
|
||||
if (!msg_data_sz(msg)) {
|
||||
struct msghdr m = {NULL,};
|
||||
if (!msg_data_sz(msg)) {
|
||||
struct msghdr m = {NULL,};
|
||||
|
||||
send_packet(NULL, newsock, &m, 0);
|
||||
advance_queue(tsock);
|
||||
} else {
|
||||
send_packet(NULL, newsock, &m, 0);
|
||||
advance_queue(tsock);
|
||||
} else {
|
||||
sock_lock(tsock);
|
||||
skb_dequeue(&sock->sk->sk_receive_queue);
|
||||
sock_unlock(tsock);
|
||||
|
@ -1497,13 +1497,13 @@ static int setsockopt(struct socket *sock,
|
|||
u32 value;
|
||||
int res;
|
||||
|
||||
if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM))
|
||||
return 0;
|
||||
if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM))
|
||||
return 0;
|
||||
if (lvl != SOL_TIPC)
|
||||
return -ENOPROTOOPT;
|
||||
if (ol < sizeof(value))
|
||||
return -EINVAL;
|
||||
if ((res = get_user(value, (u32 __user *)ov)))
|
||||
if ((res = get_user(value, (u32 __user *)ov)))
|
||||
return res;
|
||||
|
||||
if (down_interruptible(&tsock->sem))
|
||||
|
@ -1551,16 +1551,16 @@ static int getsockopt(struct socket *sock,
|
|||
int lvl, int opt, char __user *ov, int __user *ol)
|
||||
{
|
||||
struct tipc_sock *tsock = tipc_sk(sock->sk);
|
||||
int len;
|
||||
int len;
|
||||
u32 value;
|
||||
int res;
|
||||
int res;
|
||||
|
||||
if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM))
|
||||
return put_user(0, ol);
|
||||
if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM))
|
||||
return put_user(0, ol);
|
||||
if (lvl != SOL_TIPC)
|
||||
return -ENOPROTOOPT;
|
||||
if ((res = get_user(len, ol)))
|
||||
return res;
|
||||
if ((res = get_user(len, ol)))
|
||||
return res;
|
||||
|
||||
if (down_interruptible(&tsock->sem))
|
||||
return -ERESTARTSYS;
|
||||
|
@ -1595,7 +1595,7 @@ static int getsockopt(struct socket *sock,
|
|||
res = put_user(sizeof(value), ol);
|
||||
}
|
||||
|
||||
up(&tsock->sem);
|
||||
up(&tsock->sem);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -1607,18 +1607,18 @@ static int getsockopt(struct socket *sock,
|
|||
|
||||
static int ioctl(struct socket *s, u32 cmd, unsigned long arg)
|
||||
{
|
||||
return -EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int no_mmap(struct file *file, struct socket *sock,
|
||||
struct vm_area_struct *vma)
|
||||
struct vm_area_struct *vma)
|
||||
{
|
||||
return -EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
static ssize_t no_sendpage(struct socket *sock, struct page *page,
|
||||
int offset, size_t size, int flags)
|
||||
int offset, size_t size, int flags)
|
||||
{
|
||||
return -EINVAL;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int no_skpair(struct socket *s1, struct socket *s2)
|
||||
|
@ -1647,8 +1647,8 @@ static struct proto_ops msg_ops = {
|
|||
.getsockopt = getsockopt,
|
||||
.sendmsg = send_msg,
|
||||
.recvmsg = recv_msg,
|
||||
.mmap = no_mmap,
|
||||
.sendpage = no_sendpage
|
||||
.mmap = no_mmap,
|
||||
.sendpage = no_sendpage
|
||||
};
|
||||
|
||||
static struct proto_ops packet_ops = {
|
||||
|
@ -1668,8 +1668,8 @@ static struct proto_ops packet_ops = {
|
|||
.getsockopt = getsockopt,
|
||||
.sendmsg = send_packet,
|
||||
.recvmsg = recv_msg,
|
||||
.mmap = no_mmap,
|
||||
.sendpage = no_sendpage
|
||||
.mmap = no_mmap,
|
||||
.sendpage = no_sendpage
|
||||
};
|
||||
|
||||
static struct proto_ops stream_ops = {
|
||||
|
@ -1689,8 +1689,8 @@ static struct proto_ops stream_ops = {
|
|||
.getsockopt = getsockopt,
|
||||
.sendmsg = send_stream,
|
||||
.recvmsg = recv_stream,
|
||||
.mmap = no_mmap,
|
||||
.sendpage = no_sendpage
|
||||
.mmap = no_mmap,
|
||||
.sendpage = no_sendpage
|
||||
};
|
||||
|
||||
static struct net_proto_family tipc_family_ops = {
|
||||
|
@ -1714,7 +1714,7 @@ int tipc_socket_init(void)
|
|||
{
|
||||
int res;
|
||||
|
||||
res = proto_register(&tipc_proto, 1);
|
||||
res = proto_register(&tipc_proto, 1);
|
||||
if (res) {
|
||||
err("Failed to register TIPC protocol type\n");
|
||||
goto out;
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
struct subscriber {
|
||||
u32 ref;
|
||||
spinlock_t *lock;
|
||||
spinlock_t *lock;
|
||||
struct list_head subscriber_list;
|
||||
struct list_head subscription_list;
|
||||
u32 port_ref;
|
||||
|
@ -534,22 +534,22 @@ int tipc_subscr_start(void)
|
|||
return res;
|
||||
}
|
||||
|
||||
res = tipc_createport(topsrv.user_ref,
|
||||
NULL,
|
||||
TIPC_CRITICAL_IMPORTANCE,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
subscr_named_msg_event,
|
||||
NULL,
|
||||
NULL,
|
||||
&topsrv.setup_port);
|
||||
if (res)
|
||||
res = tipc_createport(topsrv.user_ref,
|
||||
NULL,
|
||||
TIPC_CRITICAL_IMPORTANCE,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
subscr_named_msg_event,
|
||||
NULL,
|
||||
NULL,
|
||||
&topsrv.setup_port);
|
||||
if (res)
|
||||
goto failed;
|
||||
|
||||
res = tipc_nametbl_publish_rsv(topsrv.setup_port, TIPC_NODE_SCOPE, &seq);
|
||||
if (res)
|
||||
res = tipc_nametbl_publish_rsv(topsrv.setup_port, TIPC_NODE_SCOPE, &seq);
|
||||
if (res)
|
||||
goto failed;
|
||||
|
||||
spin_unlock_bh(&topsrv.lock);
|
||||
|
|
|
@ -207,16 +207,16 @@ void tipc_detach(u32 userid)
|
|||
}
|
||||
|
||||
user_ptr = &users[userid];
|
||||
user_ptr->callback = NULL;
|
||||
user_ptr->callback = NULL;
|
||||
INIT_LIST_HEAD(&ports_temp);
|
||||
list_splice(&user_ptr->ports, &ports_temp);
|
||||
list_splice(&user_ptr->ports, &ports_temp);
|
||||
user_ptr->next = next_free_user;
|
||||
next_free_user = userid;
|
||||
spin_unlock_bh(®_lock);
|
||||
|
||||
atomic_dec(&tipc_user_count);
|
||||
|
||||
list_for_each_entry_safe(up_ptr, temp_up_ptr, &ports_temp, uport_list) {
|
||||
list_for_each_entry_safe(up_ptr, temp_up_ptr, &ports_temp, uport_list) {
|
||||
tipc_deleteport(up_ptr->ref);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue