From 2026364149db36c6a2c0c8cae8362fe9a7f954dd Mon Sep 17 00:00:00 2001 From: Jon Maloy Date: Thu, 22 Mar 2018 20:42:47 +0100 Subject: 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 Signed-off-by: Jon Maloy Signed-off-by: David S. Miller --- net/tipc/bearer.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) (limited to 'net/tipc/bearer.c') diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 76340b9e4851..a71f31879cb3 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c @@ -240,7 +240,6 @@ static int tipc_enable_bearer(struct net *net, const char *name, struct tipc_bearer *b; struct tipc_media *m; struct sk_buff *skb; - char addr_string[16]; int bearer_id = 0; int res = -EINVAL; char *errstr = ""; @@ -256,21 +255,6 @@ static int tipc_enable_bearer(struct net *net, const char *name, goto rejected; } - if (tipc_addr_domain_valid(disc_domain) && disc_domain != self) { - if (tipc_in_scope(disc_domain, self)) { - /* Accept any node in own cluster */ - disc_domain = self & TIPC_ZONE_CLUSTER_MASK; - res = 0; - } else if (in_own_cluster_exact(net, disc_domain)) { - /* Accept specified node in own cluster */ - res = 0; - } - } - if (res) { - errstr = "illegal discovery domain"; - goto rejected; - } - if (prio > TIPC_MAX_LINK_PRI && prio != TIPC_MEDIA_LINK_PRI) { errstr = "illegal priority"; goto rejected; @@ -354,12 +338,11 @@ static int tipc_enable_bearer(struct net *net, const char *name, return -ENOMEM; } - tipc_addr_string_fill(addr_string, disc_domain); - pr_info("Enabled bearer <%s>, discovery scope %s, priority %u\n", - name, addr_string, prio); + pr_info("Enabled bearer <%s>, priority %u\n", name, prio); + return res; rejected: - pr_warn("Bearer <%s> rejected, %s\n", name, errstr); + pr_warn("Enabling of bearer <%s> rejected, %s\n", name, errstr); return res; } @@ -865,12 +848,10 @@ int __tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info) char *bearer; struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1]; struct net *net = sock_net(skb->sk); - struct tipc_net *tn = net_generic(net, tipc_net_id); - u32 domain; + u32 domain = 0; u32 prio; prio = TIPC_MEDIA_LINK_PRI; - domain = tn->own_addr & TIPC_ZONE_CLUSTER_MASK; if (!info->attrs[TIPC_NLA_BEARER]) return -EINVAL; -- cgit v1.2.3-58-ga151