Skip to content

Commit 399574d

Browse files
Jon Maloydavem330
authored andcommitted
tipc: guarantee delivery of UP event before first broadcast
The following scenario is possible: - A user joins a group, and immediately sends out a broadcast message to its members. - The broadcast message, following a different data path than the initial JOIN message sent out during the joining procedure, arrives to a receiver before the latter.. - The receiver drops the message, since it is not ready to accept any messages until the JOIN has arrived. We avoid this by treating group protocol JOIN messages like unicast messages. - We let them pass through the recipient's multicast input queue, just like ordinary unicasts. - We force the first following broadacst to be sent as replicated unicast and being acknowledged by the recipient before accepting any more broadcast transmissions. Signed-off-by: Jon Maloy <[email protected]> Acked-by: Ying Xue <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2f48771 commit 399574d

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

net/tipc/link.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,6 +1039,7 @@ int tipc_link_retrans(struct tipc_link *l, struct tipc_link *nacker,
10391039
static bool tipc_data_input(struct tipc_link *l, struct sk_buff *skb,
10401040
struct sk_buff_head *inputq)
10411041
{
1042+
struct sk_buff_head *mc_inputq = l->bc_rcvlink->inputq;
10421043
struct tipc_msg *hdr = buf_msg(skb);
10431044

10441045
switch (msg_user(hdr)) {
@@ -1047,12 +1048,14 @@ static bool tipc_data_input(struct tipc_link *l, struct sk_buff *skb,
10471048
case TIPC_HIGH_IMPORTANCE:
10481049
case TIPC_CRITICAL_IMPORTANCE:
10491050
if (unlikely(msg_in_group(hdr) || msg_mcast(hdr))) {
1050-
skb_queue_tail(l->bc_rcvlink->inputq, skb);
1051+
skb_queue_tail(mc_inputq, skb);
10511052
return true;
10521053
}
1053-
case GROUP_PROTOCOL:
10541054
case CONN_MANAGER:
10551055
return true;
1056+
case GROUP_PROTOCOL:
1057+
skb_queue_tail(mc_inputq, skb);
1058+
return true;
10561059
case NAME_DISTRIBUTOR:
10571060
l->bc_rcvlink->state = LINK_ESTABLISHED;
10581061
skb_queue_tail(l->namedq, skb);

net/tipc/socket.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2762,6 +2762,10 @@ static int tipc_sk_join(struct tipc_sock *tsk, struct tipc_group_req *mreq)
27622762
rc = tipc_sk_publish(tsk, mreq->scope, &seq);
27632763
if (rc)
27642764
tipc_group_delete(net, grp);
2765+
2766+
/* Eliminate any risk that a broadcast overtakes the sent JOIN */
2767+
tsk->mc_method.rcast = true;
2768+
tsk->mc_method.mandatory = true;
27652769
return rc;
27662770
}
27672771

0 commit comments

Comments
 (0)