From: <eri...@er...> - 2014-12-18 16:48:30
|
From: Erik Hugne <eri...@er...> The string representation of a tipc link is in the form: <local node>:<local bearer>-<remote node>:<remote bearer> For an Ethernet bearer, this can look like 1.1.1:eth0-1.1.2:eth0 The remote bearer name is learned during link activation, and the link layer code incorrectly assumes that this name shall be stored after the last ':' character in the link. If a link is reset/reactivated, this will cause the link name to be corrupted if the remote bearer name contains a ':' character. We solve this by first isolating the remote endpoint part of the link name, and then append the remote bearer name after the remote node address. Signed-off-by: Erik Hugne <eri...@er...> --- net/tipc/link.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/tipc/link.c b/net/tipc/link.c index 23bcc11..8c45c4c 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c @@ -1461,6 +1461,7 @@ static void tipc_link_proto_rcv(struct tipc_link *l_ptr, struct sk_buff *buf) u32 max_pkt_info; u32 max_pkt_ack; u32 msg_tol; + char *remote; struct tipc_msg *msg = buf_msg(buf); /* Discard protocol message during link changeover */ @@ -1494,8 +1495,9 @@ static void tipc_link_proto_rcv(struct tipc_link *l_ptr, struct sk_buff *buf) /* fall thru' */ case ACTIVATE_MSG: /* Update link settings according other endpoint's values */ - strcpy((strrchr(l_ptr->name, ':') + 1), (char *)msg_data(msg)); - + remote = strchr(l_ptr->name, '-'); + strlcpy((strchr(remote, ':') + 1), (char *)msg_data(msg), + TIPC_MAX_BEARER_NAME); msg_tol = msg_link_tolerance(msg); if (msg_tol > l_ptr->tolerance) link_set_supervision_props(l_ptr, msg_tol); -- 2.1.3 |