All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul@parallels.com>
To: David Miller <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH 3/3] sock-diag: Report shutdown for inet and unix sockets
Date: Tue, 23 Oct 2012 21:53:02 +0400	[thread overview]
Message-ID: <5086D97E.2060503@parallels.com> (raw)
In-Reply-To: <20121023.134236.1262093514433122608.davem@davemloft.net>

On 10/23/2012 09:42 PM, David Miller wrote:
> From: Pavel Emelyanov <xemul@parallels.com>
> Date: Tue, 23 Oct 2012 20:28:22 +0400
> 
>> +static inline int shutdown_mask2u(int mask)
>> +{
>> +	/*
>> +	 * map
>> +	 * 	RCV_SHUTDOWN -> SHUT_RD
>> +	 * 	SEND_SHUTDOWN -> SHUT_WR
>> +	 * 	SHUTDOWN_MASK -> SHUT_RDWR
>> +	 */
>> +
>> +	return mask - 1;
>> +}
> 
> This is horrible.
> 
> You're returning "-1" when the socket hasn't been shutdown in any way.
> 
> Do this:
> 
> 1) Use a '1' based encoding like the kernel codes so that '0' means
>    no shutdown, as any sane interface would.  That's why we use that
>    representation internally.
> 
> 2) Get rid of all of this extension crap, and just report this value
>    in the pad byte.  In older kernels it will just be zero, which is
>    fine.

The response message of inet-diag never had any pad bytes, I'll have to
add the new attrtype (the unix-diag response has one, but I plan to add
attrtype there too for uniformity).

Thanks,
Pavel

      reply	other threads:[~2012-10-23 17:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-23 16:18 [PATCH net-next 0/3] Report socket shutdown state via sock-diag Pavel Emelyanov
2012-10-23 16:22 ` [PATCH 1/3] sk: Introduce the shutdown user-to-mask routine Pavel Emelyanov
2012-10-23 16:26 ` [PATCH 2/3] inet-diag: Get more bits for extension flag Pavel Emelyanov
2012-10-23 16:28 ` [PATCH 3/3] sock-diag: Report shutdown for inet and unix sockets Pavel Emelyanov
2012-10-23 16:53   ` Eric Dumazet
2012-10-23 17:26     ` Pavel Emelyanov
2012-10-23 17:42   ` David Miller
2012-10-23 17:53     ` Pavel Emelyanov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5086D97E.2060503@parallels.com \
    --to=xemul@parallels.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.