aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorErik Hugne <erik.hugne@ericsson.com>2013-06-17 10:54:38 -0400
committerDavid S. Miller <davem@davemloft.net>2013-06-17 18:53:00 -0400
commit5d21cb70db0122507cd18f58b4a9112583c1e075 (patch)
tree4ab1cde607414ca63347dee9f70866c6d69892f6 /net/tipc
parentcc79dd1ba9c1021c2ac6ae200a65ec38ee8db351 (diff)
tipc: allow implicit connect for stream sockets
TIPC's implied connect feature, aka piggyback connect, allows applications to save one syscall and all SYN/SYN-ACK signalling overhead when setting up a connection. Until now, this has only been supported for SEQPACKET sockets. Here, we make it possible to use this feature even with stream sockets. At the connecting side, the connection is completed when the first data message arrives from the accepting peer. This means that we must allow the connecting user to call blocking recv() before the socket has reached state SS_CONNECTED. So we must must relax the state machine check at recv_stream(), and allow the recv() call even if socket is in state SS_CONNECTING. Signed-off-by: Erik Hugne <erik.hugne@ericsson.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/socket.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index aba4255f297b..d5fa708f037d 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -518,8 +518,7 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,
518 res = -EISCONN; 518 res = -EISCONN;
519 goto exit; 519 goto exit;
520 } 520 }
521 if ((tport->published) || 521 if (tport->published) {
522 ((sock->type == SOCK_STREAM) && (total_len != 0))) {
523 res = -EOPNOTSUPP; 522 res = -EOPNOTSUPP;
524 goto exit; 523 goto exit;
525 } 524 }
@@ -1010,8 +1009,7 @@ static int recv_stream(struct kiocb *iocb, struct socket *sock,
1010 1009
1011 lock_sock(sk); 1010 lock_sock(sk);
1012 1011
1013 if (unlikely((sock->state == SS_UNCONNECTED) || 1012 if (unlikely((sock->state == SS_UNCONNECTED))) {
1014 (sock->state == SS_CONNECTING))) {
1015 res = -ENOTCONN; 1013 res = -ENOTCONN;
1016 goto exit; 1014 goto exit;
1017 } 1015 }