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 fix this by using the media address from the link entry. tipc-discussion --------------- Jon: Why do we still have media_addr left in the link struct? I was thinking about instantiating link->media_addr to point to &link_entry->maddr, but I guess you wanted this separation to actually be there to distinguish between node and link? Janson: If you want "Reported-by: Janson..." in the commit you will have to tell me your last name. And thanks again for reporting :) --------------- Fixes: 2af5ae372a4b (tipc: clean up unused code and structures) Signed-off-by: Richard Alpe <[email protected]> --- net/tipc/link.c | 19 +++++++++++-------- net/tipc/link.h | 6 ++++-- net/tipc/node.c | 13 ++++++------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/net/tipc/link.c b/net/tipc/link.c index 0c2944f..e546762 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -1264,9 +1264,10 @@ drop: /* * Send protocol message to the other endpoint. */ -static void tipc_link_proto_xmit(struct tipc_link *l, u32 msg_typ, - int probe_msg, u32 gap, u32 tolerance, - u32 priority) +static void tipc_link_proto_xmit(struct tipc_link *l, + struct tipc_media_addr *maddr, + u32 msg_typ, int probe_msg, u32 gap, + u32 tolerance, u32 priority) { struct sk_buff *skb = NULL; struct sk_buff_head xmitq; @@ -1277,7 +1278,7 @@ static void tipc_link_proto_xmit(struct tipc_link *l, u32 msg_typ, skb = __skb_dequeue(&xmitq); if (!skb) return; - tipc_bearer_xmit_skb(l->net, l->bearer_id, skb, l->media_addr); + tipc_bearer_xmit_skb(l->net, l->bearer_id, skb, maddr); l->rcv_unacked = 0; } @@ -2021,16 +2022,18 @@ msg_full: return -EMSGSIZE; } -void tipc_link_set_tolerance(struct tipc_link *l, u32 tol) +void tipc_link_set_tolerance(struct tipc_link *l, struct tipc_media_addr *maddr, + u32 tol) { l->tolerance = tol; - tipc_link_proto_xmit(l, STATE_MSG, 0, 0, tol, 0); + tipc_link_proto_xmit(l, maddr, STATE_MSG, 0, 0, tol, 0); } -void tipc_link_set_prio(struct tipc_link *l, u32 prio) +void tipc_link_set_prio(struct tipc_link *l, struct tipc_media_addr *maddr, + u32 prio) { l->priority = prio; - tipc_link_proto_xmit(l, STATE_MSG, 0, 0, 0, prio); + tipc_link_proto_xmit(l, maddr, STATE_MSG, 0, 0, 0, prio); } void tipc_link_set_abort_limit(struct tipc_link *l, u32 limit) diff --git a/net/tipc/link.h b/net/tipc/link.h index b2ae0f4..2967f60 100644 --- a/net/tipc/link.h +++ b/net/tipc/link.h @@ -112,8 +112,10 @@ char tipc_link_plane(struct tipc_link *l); int tipc_link_prio(struct tipc_link *l); int tipc_link_window(struct tipc_link *l); unsigned long tipc_link_tolerance(struct tipc_link *l); -void tipc_link_set_tolerance(struct tipc_link *l, u32 tol); -void tipc_link_set_prio(struct tipc_link *l, u32 prio); +void tipc_link_set_tolerance(struct tipc_link *l, struct tipc_media_addr *maddr, + u32 tol); +void tipc_link_set_prio(struct tipc_link *l, struct tipc_media_addr *maddr, + u32 prio); void tipc_link_set_abort_limit(struct tipc_link *l, u32 limit); void tipc_link_set_queue_limits(struct tipc_link *l, u32 window); int __tipc_nl_add_link(struct net *net, struct tipc_nl_msg *msg, diff --git a/net/tipc/node.c b/net/tipc/node.c index fa97d96..2e10962 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c @@ -1635,7 +1635,7 @@ int tipc_nl_node_set_link(struct sk_buff *skb, struct genl_info *info) int res = 0; int bearer_id; char *name; - struct tipc_link *link; + struct tipc_link_entry *le; struct tipc_node *node; struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1]; struct net *net = sock_net(skb->sk); @@ -1663,12 +1663,11 @@ int tipc_nl_node_set_link(struct sk_buff *skb, struct genl_info *info) tipc_node_read_lock(node); - link = node->links[bearer_id].link; - if (!link) { + le = &node->links[bearer_id]; + if (!le) { res = -EINVAL; goto out; } - if (attrs[TIPC_NLA_LINK_PROP]) { struct nlattr *props[TIPC_NLA_PROP_MAX + 1]; @@ -1683,19 +1682,19 @@ int tipc_nl_node_set_link(struct sk_buff *skb, struct genl_info *info) u32 tol; tol = nla_get_u32(props[TIPC_NLA_PROP_TOL]); - tipc_link_set_tolerance(link, tol); + tipc_link_set_tolerance(le->link, &le->maddr, tol); } if (props[TIPC_NLA_PROP_PRIO]) { u32 prio; prio = nla_get_u32(props[TIPC_NLA_PROP_PRIO]); - tipc_link_set_prio(link, prio); + tipc_link_set_prio(le->link, &le->maddr, prio); } if (props[TIPC_NLA_PROP_WIN]) { u32 win; win = nla_get_u32(props[TIPC_NLA_PROP_WIN]); - tipc_link_set_queue_limits(link, win); + tipc_link_set_queue_limits(le->link, win); } } -- 2.1.4 ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 _______________________________________________ tipc-discussion mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tipc-discussion
