shutdown()'s 'how' parameter doesn't seem to be used correctly

4 messages, 3 authors, 2014-02-26 · open the first message on its own page

shutdown()'s 'how' parameter doesn't seem to be used correctly

From: David Laight <hidden>
Date: 2014-02-26 15:19:06

AFAICT userspace calls shutdown(sock, how) with 'how' set to one of SHUT_RD (0),
SHUT_WR (1) or SHUT_RDWR(2).

The kernel code typically wants the bitmask of RCV_SHUTDOWN (1) | SEND_SHUTDOWN (2).
If you look at the af_unix.c unix_shutdown() there is a comment where it
add's one in order to do the conversion.

But I can't find the conversion before tcp_shutdown() or sctp_shutdown()
checks for 'how & SEND_SHUTDOWN'.
Which implies that shutdown(sock, SHUT_WR) doesn't work.

What have I missed?
Should I be passing 2 or 3 to a direct call to sock->ops->shutdown()?
(We currently pass 2 - which does outward disconnect anyway).

	David

Re: shutdown()'s 'how' parameter doesn't seem to be used correctly

From: Eric Dumazet <hidden>
Date: 2014-02-26 16:39:25

On Wed, 2014-02-26 at 15:18 +0000, David Laight wrote:
AFAICT userspace calls shutdown(sock, how) with 'how' set to one of SHUT_RD (0),
SHUT_WR (1) or SHUT_RDWR(2).

The kernel code typically wants the bitmask of RCV_SHUTDOWN (1) | SEND_SHUTDOWN (2).
If you look at the af_unix.c unix_shutdown() there is a comment where it
add's one in order to do the conversion.

But I can't find the conversion before tcp_shutdown() or sctp_shutdown()
checks for 'how & SEND_SHUTDOWN'.
Which implies that shutdown(sock, SHUT_WR) doesn't work.

What have I missed?
Should I be passing 2 or 3 to a direct call to sock->ops->shutdown()?
(We currently pass 2 - which does outward disconnect anyway).
Take a look at inet_shutdown()

RE: shutdown()'s 'how' parameter doesn't seem to be used correctly

From: David Laight <hidden>
Date: 2014-02-26 17:11:09

From: Eric Dumazet 
On Wed, 2014-02-26 at 15:18 +0000, David Laight wrote:
quoted
AFAICT userspace calls shutdown(sock, how) with 'how' set to one of SHUT_RD (0),
SHUT_WR (1) or SHUT_RDWR(2).

The kernel code typically wants the bitmask of RCV_SHUTDOWN (1) | SEND_SHUTDOWN (2).
If you look at the af_unix.c unix_shutdown() there is a comment where it
add's one in order to do the conversion.

But I can't find the conversion before tcp_shutdown() or sctp_shutdown()
checks for 'how & SEND_SHUTDOWN'.
Which implies that shutdown(sock, SHUT_WR) doesn't work.

What have I missed?
Should I be passing 2 or 3 to a direct call to sock->ops->shutdown()?
(We currently pass 2 - which does outward disconnect anyway).
Take a look at inet_shutdown()
Thanks - the lack of 'grep-friendly' structure member names makes
chasing through this code hard work.

	David

Re: shutdown()'s 'how' parameter doesn't seem to be used correctly

From: David Miller <davem@davemloft.net>
Date: 2014-02-26 18:49:17

inet_shutdown()
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help