summaryrefslogtreecommitdiffstats
path: root/net/tipc/addr.c
diff options
context:
space:
mode:
authorJon Maloy <jon.maloy@ericsson.com>2018-03-22 20:42:48 +0100
committerDavid S. Miller <davem@davemloft.net>2018-03-23 13:12:18 -0400
commitb89afb116ca2830cc982624f93e888860868a84b (patch)
tree966e4f18e0330334a3dd534b2a82da56f7dc7005 /net/tipc/addr.c
parent2026364149db36c6a2c0c8cae8362fe9a7f954dd (diff)
downloadlinux-b89afb116ca2830cc982624f93e888860868a84b.tar.gz
linux-b89afb116ca2830cc982624f93e888860868a84b.tar.bz2
linux-b89afb116ca2830cc982624f93e888860868a84b.zip
tipc: allow closest-first lookup algorithm when legacy address is configured
The removal of an internal structure of the node address has an unwanted side effect. - Currently, if a user is sending an anycast message with destination domain 0, the tipc_namebl_translate() function will use the 'closest- first' algorithm to first look for a node local destination, and only when no such is found, will it resort to the cluster global 'round- robin' lookup algorithm. - Current users can get around this, and enforce unconditional use of global round-robin by indicating a destination as Z.0.0 or Z.C.0. - This option disappears when we make the node address flat, since the lookup algorithm has no way of recognizing this case. So, as long as there are node local destinations, the algorithm will always select one of those, and there is nothing the sender can do to change this. We solve this by eliminating the 'closest-first' option, which was never a good idea anyway, for non-legacy users, but only for those. To distinguish between legacy users and non-legacy users we introduce a new flag 'legacy_addr_format' in struct tipc_core, to be set when the user configures a legacy-style Z.C.N node address. Hence, when a legacy user indicates a zero lookup domain 'closest-first' is selected, and in all other cases we use 'round-robin'. Acked-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/addr.c')
-rw-r--r--net/tipc/addr.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/net/tipc/addr.c b/net/tipc/addr.c
index dfc31a730ca5..19987994704f 100644
--- a/net/tipc/addr.c
+++ b/net/tipc/addr.c
@@ -48,15 +48,17 @@ int in_own_node(struct net *net, u32 addr)
return (addr == tn->own_addr) || !addr;
}
-int tipc_in_scope(u32 domain, u32 addr)
+bool tipc_in_scope(bool legacy_format, u32 domain, u32 addr)
{
if (!domain || (domain == addr))
- return 1;
+ return true;
+ if (!legacy_format)
+ return false;
if (domain == tipc_cluster_mask(addr)) /* domain <Z.C.0> */
- return 1;
+ return true;
if (domain == (addr & TIPC_ZONE_MASK)) /* domain <Z.0.0> */
- return 1;
- return 0;
+ return true;
+ return false;
}
char *tipc_addr_string_fill(char *string, u32 addr)