Skip to content

Commit 2a57f18

Browse files
Jon Maloydavem330
authored andcommitted
tipc: fix wrong return value from function tipc_node_try_addr()
The function for checking if there is an node address conflict is supposed to return a suggestion for a new address if it finds a conflict, and zero otherwise. But in case the peer being checked is previously unknown it does instead return a "suggestion" for the checked address itself. This results in a DSC_TRIAL_FAIL_MSG being sent unecessarily to the peer, and sometimes makes the trial period starting over again. Fixes: 25b0b9c ("tipc: handle collisions of 32-bit node address hash values") Signed-off-by: Jon Maloy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0f62aee commit 2a57f18

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

net/tipc/node.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,7 @@ static u32 tipc_node_suggest_addr(struct net *net, u32 addr)
797797
}
798798

799799
/* tipc_node_try_addr(): Check if addr can be used by peer, suggest other if not
800+
* Returns suggested address if any, otherwise 0
800801
*/
801802
u32 tipc_node_try_addr(struct net *net, u8 *id, u32 addr)
802803
{
@@ -819,12 +820,14 @@ u32 tipc_node_try_addr(struct net *net, u8 *id, u32 addr)
819820
if (n) {
820821
addr = n->addr;
821822
tipc_node_put(n);
823+
return addr;
822824
}
823-
/* Even this node may be in trial phase */
825+
826+
/* Even this node may be in conflict */
824827
if (tn->trial_addr == addr)
825828
return tipc_node_suggest_addr(net, addr);
826829

827-
return addr;
830+
return 0;
828831
}
829832

830833
void tipc_node_check_dest(struct net *net, u32 addr,

0 commit comments

Comments
 (0)