From patchwork Fri Oct 13 09:04:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Maloy X-Patchwork-Id: 825335 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yD1zb4NwNz9t0F for ; Fri, 13 Oct 2017 20:06:19 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758073AbdJMJF4 (ORCPT ); Fri, 13 Oct 2017 05:05:56 -0400 Received: from sesbmg22.ericsson.net ([193.180.251.48]:50819 "EHLO sesbmg22.ericsson.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757990AbdJMJEw (ORCPT ); Fri, 13 Oct 2017 05:04:52 -0400 X-AuditID: c1b4fb30-ef1ff70000001b7f-f6-59e081b39521 Received: from ESESSHC011.ericsson.se (Unknown_Domain [153.88.183.51]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id 32.3F.07039.3B180E95; Fri, 13 Oct 2017 11:04:51 +0200 (CEST) Received: from tipsy.lab.linux.ericsson.se (10.35.28.120) by ESESSHC011.ericsson.se (153.88.183.51) with Microsoft SMTP Server (TLS) id 14.3.352.0; Fri, 13 Oct 2017 11:04:46 +0200 From: Jon Maloy To: , CC: , , Subject: [net-next v2 16/18] tipc: guarantee delivery of UP event before first broadcast Date: Fri, 13 Oct 2017 11:04:32 +0200 Message-ID: <1507885474-11213-17-git-send-email-jon.maloy@ericsson.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1507885474-11213-1-git-send-email-jon.maloy@ericsson.com> References: <1507885474-11213-1-git-send-email-jon.maloy@ericsson.com> MIME-Version: 1.0 X-Originating-IP: [10.35.28.120] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBLMWRmVeSWpSXmKPExsUyM2K7se7mxgeRBrMvKFjMOd/CYnFsgZjF lvNZFo+vX2d2YPHYsvImk8fuBZ+ZPD5vkvNYv2UrUwBLFJdNSmpOZllqkb5dAlfGvFVTGQuu CVfcaZrA3MDYJdDFyMEhIWAi8eNzXRcjF4eQwBFGiZdt59kgnO2MErvuLGbpYuTkYBPQkHg5 rYMRxBYRMJZ4tbKTCcRmFiiQeDrxHyuILSwQIfHo9S6wOIuAqsTrgwuZQWxeAXeJU8/+gtVI CMhJnD/+EyzOCRTfMGU2O8gRQgJuEg3bxCDKBSVOznzCAjFeQuLgixdg5UICyhJzP0xjghij IPFtZjfTBEaBWUhaZiFpWcDItIpRtDi1OCk33chIL7UoM7m4OD9PLy+1ZBMjMDwPbvltsIPx 5XPHQ4wCHIxKPLxTMh9ECrEmlhVX5h5ilOBgVhLhXVcLFOJNSaysSi3Kjy8qzUktPsQozcGi JM7ruO9ChJBAemJJanZqakFqEUyWiYNTqoGRtV9cK6VRaNNur7rpYfdfhyn+jOl5831DjEWk zdpI8wj7unc/Fp1Yu9VmwcUFt/QcVrNpKwVEaHnJTo17kLKOo69NunX/3qb27OMqd6tWcq7a oa0b8N/8xmVpl66b618cMFg0/YfXYblTH2U13/NI3JU+2vTQsWnfsSyGGZvl/MSKe43n/jql xFKckWioxVxUnAgASE8V1ksCAAA= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Acked-by: Ying Xue --- net/tipc/link.c | 7 +++++-- net/tipc/socket.c | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/net/tipc/link.c b/net/tipc/link.c index 70a2149..723dd69 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -1039,6 +1039,7 @@ int tipc_link_retrans(struct tipc_link *l, struct tipc_link *nacker, static bool tipc_data_input(struct tipc_link *l, struct sk_buff *skb, struct sk_buff_head *inputq) { + struct sk_buff_head *mc_inputq = l->bc_rcvlink->inputq; struct tipc_msg *hdr = buf_msg(skb); switch (msg_user(hdr)) { @@ -1047,12 +1048,14 @@ static bool tipc_data_input(struct tipc_link *l, struct sk_buff *skb, case TIPC_HIGH_IMPORTANCE: case TIPC_CRITICAL_IMPORTANCE: if (unlikely(msg_in_group(hdr) || msg_mcast(hdr))) { - skb_queue_tail(l->bc_rcvlink->inputq, skb); + skb_queue_tail(mc_inputq, skb); return true; } - case GROUP_PROTOCOL: case CONN_MANAGER: return true; + case GROUP_PROTOCOL: + skb_queue_tail(mc_inputq, skb); + return true; case NAME_DISTRIBUTOR: l->bc_rcvlink->state = LINK_ESTABLISHED; skb_queue_tail(l->namedq, skb); diff --git a/net/tipc/socket.c b/net/tipc/socket.c index b1f1c3c..2bbab4f 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -2762,6 +2762,10 @@ static int tipc_sk_join(struct tipc_sock *tsk, struct tipc_group_req *mreq) rc = tipc_sk_publish(tsk, mreq->scope, &seq); if (rc) tipc_group_delete(net, grp); + + /* Eliminate any risk that a broadcast overtakes the sent JOIN */ + tsk->mc_method.rcast = true; + tsk->mc_method.mandatory = true; return rc; }