Commit 5edf2ba9 authored by Parthasarathy Bhuvaragan's avatar Parthasarathy Bhuvaragan Committed by Thadeu Lima de Souza Cascardo

tipc: fix random link resets while adding a second bearer

BugLink: http://bugs.launchpad.net/bugs/1688483

commit d2f394dc upstream.

In a dual bearer configuration, if the second tipc link becomes
active while the first link still has pending nametable "bulk"
updates, it randomly leads to reset of the second link.

When a link is established, the function named_distribute(),
fills the skb based on node mtu (allows room for TUNNEL_PROTOCOL)
with NAME_DISTRIBUTOR message for each PUBLICATION.
However, the function named_distribute() allocates the buffer by
increasing the node mtu by INT_H_SIZE (to insert NAME_DISTRIBUTOR).
This consumes the space allocated for TUNNEL_PROTOCOL.

When establishing the second link, the link shall tunnel all the
messages in the first link queue including the "bulk" update.
As size of the NAME_DISTRIBUTOR messages while tunnelling, exceeds
the link mtu the transmission fails (-EMSGSIZE).

Thus, the synch point based on the message count of the tunnel
packets is never reached leading to link timeout.

In this commit, we adjust the size of name distributor message so that
they can be tunnelled.
Reviewed-by: default avatarJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: default avatarParthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarThadeu Lima de Souza Cascardo <cascardo@canonical.com>
parent e51261df
...@@ -62,6 +62,8 @@ static void publ_to_item(struct distr_item *i, struct publication *p) ...@@ -62,6 +62,8 @@ static void publ_to_item(struct distr_item *i, struct publication *p)
/** /**
* named_prepare_buf - allocate & initialize a publication message * named_prepare_buf - allocate & initialize a publication message
*
* The buffer returned is of size INT_H_SIZE + payload size
*/ */
static struct sk_buff *named_prepare_buf(struct net *net, u32 type, u32 size, static struct sk_buff *named_prepare_buf(struct net *net, u32 type, u32 size,
u32 dest) u32 dest)
...@@ -166,9 +168,9 @@ static void named_distribute(struct net *net, struct sk_buff_head *list, ...@@ -166,9 +168,9 @@ static void named_distribute(struct net *net, struct sk_buff_head *list,
struct publication *publ; struct publication *publ;
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
struct distr_item *item = NULL; struct distr_item *item = NULL;
uint msg_dsz = (tipc_node_get_mtu(net, dnode, 0) / ITEM_SIZE) * u32 msg_dsz = ((tipc_node_get_mtu(net, dnode, 0) - INT_H_SIZE) /
ITEM_SIZE; ITEM_SIZE) * ITEM_SIZE;
uint msg_rem = msg_dsz; u32 msg_rem = msg_dsz;
list_for_each_entry(publ, pls, local_list) { list_for_each_entry(publ, pls, local_list) {
/* Prepare next buffer: */ /* Prepare next buffer: */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment