aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/socket.c
diff options
context:
space:
mode:
authorJon Maloy <jon.maloy@ericsson.com>2018-03-15 11:48:51 -0400
committerDavid S. Miller <davem@davemloft.net>2018-03-17 17:11:46 -0400
commit928df1880e24bcd47d6359ff86df24db3dfba3c3 (patch)
treeb191aaca13f510bfd7409089d47f5346403a68e3 /net/tipc/socket.c
parent4f1aec01fcb84faf79bb6fabb82a5c850b186e03 (diff)
tipc: obsolete TIPC_ZONE_SCOPE
Publications for TIPC_CLUSTER_SCOPE and TIPC_ZONE_SCOPE are in all aspects handled the same way, both on the publishing node and on the receiving nodes. Despite previous ambitions to the contrary, this is never going to change, so we take the conseqeunce of this and obsolete TIPC_ZONE_SCOPE and related macros/functions. Whenever a user is doing a bind() or a sendmsg() attempt using ZONE_SCOPE we translate this internally to CLUSTER_SCOPE, while we remain compatible with users and remote nodes still using ZONE_SCOPE. Furthermore, the non-formalized scope value 0 has always been permitted for use during lookup, with the same meaning as ZONE_SCOPE/CLUSTER_SCOPE. We now permit it even as binding scope, but for compatibility reasons we choose to not change the value of TIPC_CLUSTER_SCOPE. 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/socket.c')
-rw-r--r--net/tipc/socket.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 8b04e601311c..910d3827f499 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -644,7 +644,7 @@ static int tipc_bind(struct socket *sock, struct sockaddr *uaddr,
644 goto exit; 644 goto exit;
645 } 645 }
646 646
647 res = (addr->scope > 0) ? 647 res = (addr->scope >= 0) ?
648 tipc_sk_publish(tsk, addr->scope, &addr->addr.nameseq) : 648 tipc_sk_publish(tsk, addr->scope, &addr->addr.nameseq) :
649 tipc_sk_withdraw(tsk, -addr->scope, &addr->addr.nameseq); 649 tipc_sk_withdraw(tsk, -addr->scope, &addr->addr.nameseq);
650exit: 650exit:
@@ -1280,8 +1280,8 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
1280 struct tipc_msg *hdr = &tsk->phdr; 1280 struct tipc_msg *hdr = &tsk->phdr;
1281 struct tipc_name_seq *seq; 1281 struct tipc_name_seq *seq;
1282 struct sk_buff_head pkts; 1282 struct sk_buff_head pkts;
1283 u32 type, inst, domain;
1284 u32 dnode, dport; 1283 u32 dnode, dport;
1284 u32 type, inst;
1285 int mtu, rc; 1285 int mtu, rc;
1286 1286
1287 if (unlikely(dlen > TIPC_MAX_USER_MSG_SIZE)) 1287 if (unlikely(dlen > TIPC_MAX_USER_MSG_SIZE))
@@ -1332,13 +1332,12 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
1332 if (dest->addrtype == TIPC_ADDR_NAME) { 1332 if (dest->addrtype == TIPC_ADDR_NAME) {
1333 type = dest->addr.name.name.type; 1333 type = dest->addr.name.name.type;
1334 inst = dest->addr.name.name.instance; 1334 inst = dest->addr.name.name.instance;
1335 domain = dest->addr.name.domain; 1335 dnode = dest->addr.name.domain;
1336 dnode = domain;
1337 msg_set_type(hdr, TIPC_NAMED_MSG); 1336 msg_set_type(hdr, TIPC_NAMED_MSG);
1338 msg_set_hdr_sz(hdr, NAMED_H_SIZE); 1337 msg_set_hdr_sz(hdr, NAMED_H_SIZE);
1339 msg_set_nametype(hdr, type); 1338 msg_set_nametype(hdr, type);
1340 msg_set_nameinst(hdr, inst); 1339 msg_set_nameinst(hdr, inst);
1341 msg_set_lookup_scope(hdr, tipc_addr_scope(domain)); 1340 msg_set_lookup_scope(hdr, tipc_node2scope(dnode));
1342 dport = tipc_nametbl_translate(net, type, inst, &dnode); 1341 dport = tipc_nametbl_translate(net, type, inst, &dnode);
1343 msg_set_destnode(hdr, dnode); 1342 msg_set_destnode(hdr, dnode);
1344 msg_set_destport(hdr, dport); 1343 msg_set_destport(hdr, dport);
@@ -2592,6 +2591,9 @@ static int tipc_sk_publish(struct tipc_sock *tsk, uint scope,
2592 struct publication *publ; 2591 struct publication *publ;
2593 u32 key; 2592 u32 key;
2594 2593
2594 if (scope != TIPC_NODE_SCOPE)
2595 scope = TIPC_CLUSTER_SCOPE;
2596
2595 if (tipc_sk_connected(sk)) 2597 if (tipc_sk_connected(sk))
2596 return -EINVAL; 2598 return -EINVAL;
2597 key = tsk->portid + tsk->pub_count + 1; 2599 key = tsk->portid + tsk->pub_count + 1;
@@ -2617,6 +2619,9 @@ static int tipc_sk_withdraw(struct tipc_sock *tsk, uint scope,
2617 struct publication *safe; 2619 struct publication *safe;
2618 int rc = -EINVAL; 2620 int rc = -EINVAL;
2619 2621
2622 if (scope != TIPC_NODE_SCOPE)
2623 scope = TIPC_CLUSTER_SCOPE;
2624
2620 list_for_each_entry_safe(publ, safe, &tsk->publications, pport_list) { 2625 list_for_each_entry_safe(publ, safe, &tsk->publications, pport_list) {
2621 if (seq) { 2626 if (seq) {
2622 if (publ->scope != scope) 2627 if (publ->scope != scope)