diff options
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r-- | net/tipc/socket.c | 15 |
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); |
650 | exit: | 650 | exit: |
@@ -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) |