summaryrefslogtreecommitdiff
path: root/net/tipc
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2011-10-24 13:05:55 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2011-12-27 11:33:50 -0500
commit2b78f9a002dccc587912af4da3bf1db86909de91 (patch)
tree60dafc91a970c116e7d8c3f53152a75f9e77d854 /net/tipc
parentcd3decdfd1dbab8a585eafe2e5b9866f193de99e (diff)
downloadlinux-3.10-2b78f9a002dccc587912af4da3bf1db86909de91.tar.gz
linux-3.10-2b78f9a002dccc587912af4da3bf1db86909de91.tar.bz2
linux-3.10-2b78f9a002dccc587912af4da3bf1db86909de91.zip
tipc: Handle broadcast attempt when no neighboring nodes exist
Adds a check to detect when an attempt is made to send a message via the broadcast link and no neighboring nodes are currently available to receive it. Rather than wasting effort passing the message to the broadcast link and broadcast bearer, who will only throw it away, TIPC now frees the message immediately and reports success (i.e. the message has been delivered to all available destinations). Signed-off-by: Allan Stephens <allan.stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/bcast.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index 5ca8fdda63c..8f58df24bac 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -417,13 +417,19 @@ int tipc_bclink_send_msg(struct sk_buff *buf)
spin_lock_bh(&bc_lock);
+ if (!bclink->bcast_nodes.count) {
+ res = msg_data_sz(buf_msg(buf));
+ buf_discard(buf);
+ goto exit;
+ }
+
res = tipc_link_send_buf(bcl, buf);
if (likely(res > 0))
bclink_set_last_sent();
bcl->stats.queue_sz_counts++;
bcl->stats.accu_queue_sz += bcl->out_queue_size;
-
+exit:
spin_unlock_bh(&bc_lock);
return res;
}