diff options
author | Ying Xue <ying.xue@windriver.com> | 2011-07-06 06:01:13 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2011-09-17 22:55:12 -0400 |
commit | 245f3d342dccad293d0cd0bbe231051b2daa695f (patch) | |
tree | 99d98e46ab9cb8bdfaf994b3faeda2239fe1b789 /net/tipc | |
parent | 1d835874af143a5c8273268d09e2f259b4c1ba89 (diff) |
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: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/socket.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 2f90beba282b..9440a3d48ca0 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -1483,9 +1483,7 @@ static int listen(struct socket *sock, int len) | |||
1483 | 1483 | ||
1484 | lock_sock(sk); | 1484 | lock_sock(sk); |
1485 | 1485 | ||
1486 | if (sock->state == SS_READY) | 1486 | if (sock->state != SS_UNCONNECTED) |
1487 | res = -EOPNOTSUPP; | ||
1488 | else if (sock->state != SS_UNCONNECTED) | ||
1489 | res = -EINVAL; | 1487 | res = -EINVAL; |
1490 | else { | 1488 | else { |
1491 | sock->state = SS_LISTENING; | 1489 | sock->state = SS_LISTENING; |
@@ -1513,10 +1511,6 @@ static int accept(struct socket *sock, struct socket *new_sock, int flags) | |||
1513 | 1511 | ||
1514 | lock_sock(sk); | 1512 | lock_sock(sk); |
1515 | 1513 | ||
1516 | if (sock->state == SS_READY) { | ||
1517 | res = -EOPNOTSUPP; | ||
1518 | goto exit; | ||
1519 | } | ||
1520 | if (sock->state != SS_LISTENING) { | 1514 | if (sock->state != SS_LISTENING) { |
1521 | res = -EINVAL; | 1515 | res = -EINVAL; |
1522 | goto exit; | 1516 | goto exit; |
@@ -1793,11 +1787,11 @@ static const struct proto_ops msg_ops = { | |||
1793 | .bind = bind, | 1787 | .bind = bind, |
1794 | .connect = connect, | 1788 | .connect = connect, |
1795 | .socketpair = sock_no_socketpair, | 1789 | .socketpair = sock_no_socketpair, |
1796 | .accept = accept, | 1790 | .accept = sock_no_accept, |
1797 | .getname = get_name, | 1791 | .getname = get_name, |
1798 | .poll = poll, | 1792 | .poll = poll, |
1799 | .ioctl = sock_no_ioctl, | 1793 | .ioctl = sock_no_ioctl, |
1800 | .listen = listen, | 1794 | .listen = sock_no_listen, |
1801 | .shutdown = shutdown, | 1795 | .shutdown = shutdown, |
1802 | .setsockopt = setsockopt, | 1796 | .setsockopt = setsockopt, |
1803 | .getsockopt = getsockopt, | 1797 | .getsockopt = getsockopt, |