aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/socket.c
diff options
context:
space:
mode:
authorJon Maloy <jon.maloy@ericsson.com>2017-10-13 05:04:30 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-13 11:46:01 -0400
commitb87a5ea31c935a7f7e11ca85df2ec7917921e96d (patch)
tree6d8d1235da6271bea5506b6564205583a4772305 /net/tipc/socket.c
parent5b8dddb63769587badc50725ec9857caaeba4de0 (diff)
tipc: guarantee group unicast doesn't bypass group broadcast
Group unicast messages don't follow the same path as broadcast messages, and there is a high risk that unicasts sent from a socket might bypass previously sent broadcasts from the same socket. We fix this by letting all unicast messages carry the sequence number of the next sent broadcast from the same node, but without updating this number at the receiver. This way, a receiver can check and if necessary re-order such messages before they are added to the socket receive buffer. Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Acked-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r--net/tipc/socket.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 8fdd969e12bd..3276b7a0d445 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -830,6 +830,7 @@ static int tipc_send_group_msg(struct net *net, struct tipc_sock *tsk,
830 struct msghdr *m, struct tipc_member *mb, 830 struct msghdr *m, struct tipc_member *mb,
831 u32 dnode, u32 dport, int dlen) 831 u32 dnode, u32 dport, int dlen)
832{ 832{
833 u16 bc_snd_nxt = tipc_group_bc_snd_nxt(tsk->group);
833 int blks = tsk_blocks(GROUP_H_SIZE + dlen); 834 int blks = tsk_blocks(GROUP_H_SIZE + dlen);
834 struct tipc_msg *hdr = &tsk->phdr; 835 struct tipc_msg *hdr = &tsk->phdr;
835 struct sk_buff_head pkts; 836 struct sk_buff_head pkts;
@@ -840,6 +841,7 @@ static int tipc_send_group_msg(struct net *net, struct tipc_sock *tsk,
840 msg_set_hdr_sz(hdr, GROUP_H_SIZE); 841 msg_set_hdr_sz(hdr, GROUP_H_SIZE);
841 msg_set_destport(hdr, dport); 842 msg_set_destport(hdr, dport);
842 msg_set_destnode(hdr, dnode); 843 msg_set_destnode(hdr, dnode);
844 msg_set_grp_bc_seqno(hdr, bc_snd_nxt);
843 845
844 /* Build message as chain of buffers */ 846 /* Build message as chain of buffers */
845 skb_queue_head_init(&pkts); 847 skb_queue_head_init(&pkts);