Skip to content

Commit

Permalink
tipc: Simplify prohibition of listen and accept for connectionless so…
Browse files Browse the repository at this point in the history
…ckets

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: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
  • Loading branch information
Ying Xue authored and Paul Gortmaker committed Sep 18, 2011
1 parent 1d83587 commit 245f3d3
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions net/tipc/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1483,9 +1483,7 @@ static int listen(struct socket *sock, int len)

lock_sock(sk);

if (sock->state == SS_READY)
res = -EOPNOTSUPP;
else if (sock->state != SS_UNCONNECTED)
if (sock->state != SS_UNCONNECTED)
res = -EINVAL;
else {
sock->state = SS_LISTENING;
Expand Down Expand Up @@ -1513,10 +1511,6 @@ static int accept(struct socket *sock, struct socket *new_sock, int flags)

lock_sock(sk);

if (sock->state == SS_READY) {
res = -EOPNOTSUPP;
goto exit;
}
if (sock->state != SS_LISTENING) {
res = -EINVAL;
goto exit;
Expand Down Expand Up @@ -1793,11 +1787,11 @@ static const struct proto_ops msg_ops = {
.bind = bind,
.connect = connect,
.socketpair = sock_no_socketpair,
.accept = accept,
.accept = sock_no_accept,
.getname = get_name,
.poll = poll,
.ioctl = sock_no_ioctl,
.listen = listen,
.listen = sock_no_listen,
.shutdown = shutdown,
.setsockopt = setsockopt,
.getsockopt = getsockopt,
Expand Down

0 comments on commit 245f3d3

Please sign in to comment.