diff options
author | Jon Maloy <jon.maloy@ericsson.com> | 2018-03-22 20:42:47 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-03-23 13:12:18 -0400 |
commit | 2026364149db36c6a2c0c8cae8362fe9a7f954dd (patch) | |
tree | 267dc296fc385f53a8bd9537c9ac8193ea4b5663 /net/tipc/addr.c | |
parent | b39e465e56ec38ca64b4c0affeb6411eb0ed7267 (diff) |
tipc: remove restrictions on node address values
Nominally, TIPC organizes network nodes into a three-level network
hierarchy consisting of the levels 'zone', 'cluster' and 'node'. This
hierarchy is reflected in the node address format, - it is sub-divided
into an 8-bit zone id, and 12 bit cluster id, and a 12-bit node id.
However, the 'zone' and 'cluster' levels have in reality never been
fully implemented,and never will be. The result of this has been
that the first 20 bits the node identity structure have been wasted,
and the usable node identity range within a cluster has been limited
to 12 bits. This is starting to become a problem.
In the following commits, we will need to be able to connect between
nodes which are using the whole 32-bit value space of the node address.
We therefore remove the restrictions on which values can be assigned
to node identity, -it is from now on only a 32-bit integer with no
assumed internal structure.
Isolation between clusters is now achieved only by setting different
values for the 'network id' field used during neighbor discovery, in
practice leading to the latter becoming the new cluster identity.
The rules for accepting discovery requests/responses from neighboring
nodes now become:
- If the user is using legacy address format on both peers, reception
of discovery messages is subject to the legacy lookup domain check
in addition to the cluster id check.
- Otherwise, the discovery request/response is always accepted, provided
both peers have the same network id.
This secures backwards compatibility for users who have been using zone
or cluster identities as cluster separators, instead of the intended
'network id'.
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.c | 50 |
1 files changed, 1 insertions, 49 deletions
diff --git a/net/tipc/addr.c b/net/tipc/addr.c index 97cd857d7f43..dfc31a730ca5 100644 --- a/net/tipc/addr.c +++ b/net/tipc/addr.c @@ -39,21 +39,6 @@ #include "core.h" /** - * in_own_cluster - test for cluster inclusion; <0.0.0> always matches - */ -int in_own_cluster(struct net *net, u32 addr) -{ - return in_own_cluster_exact(net, addr) || !addr; -} - -int in_own_cluster_exact(struct net *net, u32 addr) -{ - struct tipc_net *tn = net_generic(net, tipc_net_id); - - return !((addr ^ tn->own_addr) >> 12); -} - -/** * in_own_node - test for node inclusion; <0.0.0> always matches */ int in_own_node(struct net *net, u32 addr) @@ -63,46 +48,13 @@ int in_own_node(struct net *net, u32 addr) return (addr == tn->own_addr) || !addr; } -/** - * tipc_addr_domain_valid - validates a network domain address - * - * Accepts <Z.C.N>, <Z.C.0>, <Z.0.0>, and <0.0.0>, - * where Z, C, and N are non-zero. - * - * Returns 1 if domain address is valid, otherwise 0 - */ -int tipc_addr_domain_valid(u32 addr) -{ - u32 n = tipc_node(addr); - u32 c = tipc_cluster(addr); - u32 z = tipc_zone(addr); - - if (n && (!z || !c)) - return 0; - if (c && !z) - return 0; - return 1; -} - -/** - * tipc_addr_node_valid - validates a proposed network address for this node - * - * Accepts <Z.C.N>, where Z, C, and N are non-zero. - * - * Returns 1 if address can be used, otherwise 0 - */ -int tipc_addr_node_valid(u32 addr) -{ - return tipc_addr_domain_valid(addr) && tipc_node(addr); -} - int tipc_in_scope(u32 domain, u32 addr) { if (!domain || (domain == addr)) return 1; if (domain == tipc_cluster_mask(addr)) /* domain <Z.C.0> */ return 1; - if (domain == tipc_zone_mask(addr)) /* domain <Z.0.0> */ + if (domain == (addr & TIPC_ZONE_MASK)) /* domain <Z.0.0> */ return 1; return 0; } |