* shutdown()'s 'how' parameter doesn't seem to be used correctly
@ 2014-02-26 15:18 David Laight
2014-02-26 16:39 ` Eric Dumazet
2014-02-26 18:49 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: David Laight @ 2014-02-26 15:18 UTC (permalink / raw)
To: netdev
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: shutdown()'s 'how' parameter doesn't seem to be used correctly
2014-02-26 15:18 shutdown()'s 'how' parameter doesn't seem to be used correctly David Laight
@ 2014-02-26 16:39 ` Eric Dumazet
2014-02-26 17:10 ` David Laight
2014-02-26 18:49 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2014-02-26 16:39 UTC (permalink / raw)
To: David Laight; +Cc: netdev
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()
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: shutdown()'s 'how' parameter doesn't seem to be used correctly
2014-02-26 16:39 ` Eric Dumazet
@ 2014-02-26 17:10 ` David Laight
0 siblings, 0 replies; 4+ messages in thread
From: David Laight @ 2014-02-26 17:10 UTC (permalink / raw)
To: 'Eric Dumazet'; +Cc: netdev
From: Eric Dumazet
> 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()
Thanks - the lack of 'grep-friendly' structure member names makes
chasing through this code hard work.
David
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: shutdown()'s 'how' parameter doesn't seem to be used correctly
2014-02-26 15:18 shutdown()'s 'how' parameter doesn't seem to be used correctly David Laight
2014-02-26 16:39 ` Eric Dumazet
@ 2014-02-26 18:49 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2014-02-26 18:49 UTC (permalink / raw)
To: David.Laight; +Cc: netdev
inet_shutdown()
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-02-26 18:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-26 15:18 shutdown()'s 'how' parameter doesn't seem to be used correctly David Laight
2014-02-26 16:39 ` Eric Dumazet
2014-02-26 17:10 ` David Laight
2014-02-26 18:49 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.