Skip to content

Commit d27383f

Browse files
Richard Alpegregkh
authored andcommitted
tipc: fix link attribute propagation bug
commit d01332f1acacc0cb43a61f4244dd2b846d4cd585 upstream. Changing certain link attributes (link tolerance and link priority) from the TIPC management tool is supposed to automatically take effect at both endpoints of the affected link. Currently the media address is not instantiated for the link and is used uninstantiated when crafting protocol messages designated for the peer endpoint. This means that changing a link property currently results in the property being changed on the local machine but the protocol message designated for the peer gets lost. Resulting in property discrepancy between the endpoints. In this patch we resolve this by using the media address from the link entry and using the bearer transmit function to send it. Hence, we can now eliminate the redundant function tipc_link_prot_xmit() and the redundant field tipc_link::media_addr. Fixes: 2af5ae3 (tipc: clean up unused code and structures) Reviewed-by: Jon Maloy <jon.maloy@ericsson.com> Reported-by: Jason Hu <huzhijiang@gmail.com> Signed-off-by: Richard Alpe <richard.alpe@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net> [backported to 4.4 by Tommi Rantala] Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c8f1391 commit d27383f

2 files changed

Lines changed: 6 additions & 23 deletions

File tree

net/tipc/link.c

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,25 +1084,6 @@ int tipc_link_rcv(struct tipc_link *l, struct sk_buff *skb,
10841084
return rc;
10851085
}
10861086

1087-
/*
1088-
* Send protocol message to the other endpoint.
1089-
*/
1090-
void tipc_link_proto_xmit(struct tipc_link *l, u32 msg_typ, int probe_msg,
1091-
u32 gap, u32 tolerance, u32 priority)
1092-
{
1093-
struct sk_buff *skb = NULL;
1094-
struct sk_buff_head xmitq;
1095-
1096-
__skb_queue_head_init(&xmitq);
1097-
tipc_link_build_proto_msg(l, msg_typ, probe_msg, gap,
1098-
tolerance, priority, &xmitq);
1099-
skb = __skb_dequeue(&xmitq);
1100-
if (!skb)
1101-
return;
1102-
tipc_bearer_xmit_skb(l->net, l->bearer_id, skb, l->media_addr);
1103-
l->rcv_unacked = 0;
1104-
}
1105-
11061087
static void tipc_link_build_proto_msg(struct tipc_link *l, int mtyp, bool probe,
11071088
u16 rcvgap, int tolerance, int priority,
11081089
struct sk_buff_head *xmitq)
@@ -1636,9 +1617,12 @@ int tipc_nl_link_set(struct sk_buff *skb, struct genl_info *info)
16361617
char *name;
16371618
struct tipc_link *link;
16381619
struct tipc_node *node;
1620+
struct sk_buff_head xmitq;
16391621
struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1];
16401622
struct net *net = sock_net(skb->sk);
16411623

1624+
__skb_queue_head_init(&xmitq);
1625+
16421626
if (!info->attrs[TIPC_NLA_LINK])
16431627
return -EINVAL;
16441628

@@ -1683,14 +1667,14 @@ int tipc_nl_link_set(struct sk_buff *skb, struct genl_info *info)
16831667

16841668
tol = nla_get_u32(props[TIPC_NLA_PROP_TOL]);
16851669
link->tolerance = tol;
1686-
tipc_link_proto_xmit(link, STATE_MSG, 0, 0, tol, 0);
1670+
tipc_link_build_proto_msg(link, STATE_MSG, 0, 0, tol, 0, &xmitq);
16871671
}
16881672
if (props[TIPC_NLA_PROP_PRIO]) {
16891673
u32 prio;
16901674

16911675
prio = nla_get_u32(props[TIPC_NLA_PROP_PRIO]);
16921676
link->priority = prio;
1693-
tipc_link_proto_xmit(link, STATE_MSG, 0, 0, 0, prio);
1677+
tipc_link_build_proto_msg(link, STATE_MSG, 0, 0, 0, prio, &xmitq);
16941678
}
16951679
if (props[TIPC_NLA_PROP_WIN]) {
16961680
u32 win;
@@ -1702,7 +1686,7 @@ int tipc_nl_link_set(struct sk_buff *skb, struct genl_info *info)
17021686

17031687
out:
17041688
tipc_node_unlock(node);
1705-
1689+
tipc_bearer_xmit(net, bearer_id, &xmitq, &node->links[bearer_id].maddr);
17061690
return res;
17071691
}
17081692

net/tipc/link.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ struct tipc_stats {
153153
struct tipc_link {
154154
u32 addr;
155155
char name[TIPC_MAX_LINK_NAME];
156-
struct tipc_media_addr *media_addr;
157156
struct net *net;
158157

159158
/* Management and link supervision data */

0 commit comments

Comments
 (0)