aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorParthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>2016-11-01 09:02:39 -0400
committerDavid S. Miller <davem@davemloft.net>2016-11-01 11:53:24 -0400
commit87227fe7e42060af9bc8977fc17427e7c9cadb5d (patch)
treefd48b034aa83f676a168d48f21de8c980c58dfd5 /net/tipc
parentaeda16b6aec88b8b0135d678281e2f20fc9258e6 (diff)
tipc: remove tsk->connected for connectionless sockets
Until now, for connectionless sockets the peer information during connect is stored in tsk->peer and a connection state is set in tsk->connected. This is redundant. In this commit, for connectionless sockets we update: - __tipc_sendmsg(), when the destination is NULL the peer existence is determined by tsk->peer.family, instead of tsk->connected. - tipc_connect(), remove set/unset of tsk->connected. Hence tsk->connected is no longer used for connectionless sockets. There is no functional change in this commit. Acked-by: Ying Xue <ying.xue@windriver.com> Acked-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/socket.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 0546556d3517..524abe47560d 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -902,7 +902,7 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dsz)
902 if (dsz > TIPC_MAX_USER_MSG_SIZE) 902 if (dsz > TIPC_MAX_USER_MSG_SIZE)
903 return -EMSGSIZE; 903 return -EMSGSIZE;
904 if (unlikely(!dest)) { 904 if (unlikely(!dest)) {
905 if (tsk->connected && sock->state == SS_READY) 905 if (sock->state == SS_READY && tsk->peer.family == AF_TIPC)
906 dest = &tsk->peer; 906 dest = &tsk->peer;
907 else 907 else
908 return -EDESTADDRREQ; 908 return -EDESTADDRREQ;
@@ -1939,12 +1939,10 @@ static int tipc_connect(struct socket *sock, struct sockaddr *dest,
1939 if (sock->state == SS_READY) { 1939 if (sock->state == SS_READY) {
1940 if (dst->family == AF_UNSPEC) { 1940 if (dst->family == AF_UNSPEC) {
1941 memset(&tsk->peer, 0, sizeof(struct sockaddr_tipc)); 1941 memset(&tsk->peer, 0, sizeof(struct sockaddr_tipc));
1942 tsk->connected = 0;
1943 } else if (destlen != sizeof(struct sockaddr_tipc)) { 1942 } else if (destlen != sizeof(struct sockaddr_tipc)) {
1944 res = -EINVAL; 1943 res = -EINVAL;
1945 } else { 1944 } else {
1946 memcpy(&tsk->peer, dest, destlen); 1945 memcpy(&tsk->peer, dest, destlen);
1947 tsk->connected = 1;
1948 } 1946 }
1949 goto exit; 1947 goto exit;
1950 } 1948 }