Commit 245f3d34 authored by Ying Xue's avatar Ying Xue Committed by Paul Gortmaker

tipc: Simplify prohibition of listen and accept for connectionless sockets

Modifies the proto_ops structure used by TIPC DGRAM and RDM sockets
so that calls to listen() and accept() are handled by existing kernel
"unsupported operation" routines, and eliminates the related checks
in the listen and accept routines used by SEQPACKET and STREAM sockets
that are no longer needed.
Signed-off-by: default avatarYing Xue <ying.xue@windriver.com>
Signed-off-by: default avatarAllan Stephens <allan.stephens@windriver.com>
Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
parent 1d835874
...@@ -1483,9 +1483,7 @@ static int listen(struct socket *sock, int len) ...@@ -1483,9 +1483,7 @@ static int listen(struct socket *sock, int len)
lock_sock(sk); lock_sock(sk);
if (sock->state == SS_READY) if (sock->state != SS_UNCONNECTED)
res = -EOPNOTSUPP;
else if (sock->state != SS_UNCONNECTED)
res = -EINVAL; res = -EINVAL;
else { else {
sock->state = SS_LISTENING; sock->state = SS_LISTENING;
...@@ -1513,10 +1511,6 @@ static int accept(struct socket *sock, struct socket *new_sock, int flags) ...@@ -1513,10 +1511,6 @@ static int accept(struct socket *sock, struct socket *new_sock, int flags)
lock_sock(sk); lock_sock(sk);
if (sock->state == SS_READY) {
res = -EOPNOTSUPP;
goto exit;
}
if (sock->state != SS_LISTENING) { if (sock->state != SS_LISTENING) {
res = -EINVAL; res = -EINVAL;
goto exit; goto exit;
...@@ -1793,11 +1787,11 @@ static const struct proto_ops msg_ops = { ...@@ -1793,11 +1787,11 @@ static const struct proto_ops msg_ops = {
.bind = bind, .bind = bind,
.connect = connect, .connect = connect,
.socketpair = sock_no_socketpair, .socketpair = sock_no_socketpair,
.accept = accept, .accept = sock_no_accept,
.getname = get_name, .getname = get_name,
.poll = poll, .poll = poll,
.ioctl = sock_no_ioctl, .ioctl = sock_no_ioctl,
.listen = listen, .listen = sock_no_listen,
.shutdown = shutdown, .shutdown = shutdown,
.setsockopt = setsockopt, .setsockopt = setsockopt,
.getsockopt = getsockopt, .getsockopt = getsockopt,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment