diff options
author | Jon Maloy <jmaloy@redhat.com> | 2020-11-25 21:29:14 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-11-28 04:34:01 +0300 |
commit | 5f75e0a0e92a6c6ef93d61fb4d1d2a185cdbc2f9 (patch) | |
tree | ac8ba77cffe46b36e41b4c40eb55402209ae559c /net/tipc/addr.h | |
parent | 60c102eedea0e487c897dd23cc7fefecf4449769 (diff) | |
download | linux-5f75e0a0e92a6c6ef93d61fb4d1d2a185cdbc2f9.tar.xz |
tipc: make node number calculation reproducible
The 32-bit node number, aka node hash or node address, is calculated
based on the 128-bit node identity when it is not set explicitly by
the user. In future commits we will need to perform this hash operation
on peer nodes while feeling safe that we obtain the same result.
We do this by interpreting the initial hash as a network byte order
number. Whenever we need to use the number locally on a node
we must therefore translate it to host byte order to obtain an
architecure independent result.
Furthermore, given the context where we use this number, we must not
allow it to be zero unless the node identity also is zero. Hence, in
the rare cases when the xor-ed hash value may end up as zero we replace
it with a fix number, knowing that the code anyway is capable of
handling hash collisions.
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/tipc/addr.h')
-rw-r--r-- | net/tipc/addr.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/tipc/addr.h b/net/tipc/addr.h index 31bee0ea7b3e..1a11831bef62 100644 --- a/net/tipc/addr.h +++ b/net/tipc/addr.h @@ -3,6 +3,7 @@ * * Copyright (c) 2000-2006, 2018, Ericsson AB * Copyright (c) 2004-2005, Wind River Systems + * Copyright (c) 2020, Red Hat Inc * All rights reserved. * * Redistribution and use in source and binary forms, with or without |