All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul@parallels.com>
To: Linux Netdev List <netdev@vger.kernel.org>,
	David Miller <davem@davemloft.net>
Subject: [PATCH 2/3] inet-diag: Get more bits for extension flag
Date: Tue, 23 Oct 2012 20:26:04 +0400	[thread overview]
Message-ID: <5086C51C.7040403@parallels.com> (raw)
In-Reply-To: <5086C36B.6060508@parallels.com>

The inet-diag dumping request carries 8-bit ext value which denotes what
additional info we want to see. Unfortunately there's only one bit left
on it and occupying one with the "I want shutdown" is unwanted.

However, there are 8 more bits in the request and this "pad" field is
currently unused. I propose to make the 8th bit of the existing ext flag
mean "this unused space contains more ext bits".

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
---
 include/uapi/linux/inet_diag.h |    3 ++-
 net/ipv4/inet_diag.c           |    3 +++
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/include/uapi/linux/inet_diag.h b/include/uapi/linux/inet_diag.h
index 8c469af..c5e14f6 100644
--- a/include/uapi/linux/inet_diag.h
+++ b/include/uapi/linux/inet_diag.h
@@ -38,7 +38,7 @@ struct inet_diag_req_v2 {
 	__u8	sdiag_family;
 	__u8	sdiag_protocol;
 	__u8	idiag_ext;
-	__u8	pad;
+	__u8	idiag_ext2;
 	__u32	idiag_states;
 	struct inet_diag_sockid id;
 };
@@ -109,6 +109,7 @@ enum {
 	INET_DIAG_TOS,
 	INET_DIAG_TCLASS,
 	INET_DIAG_SKMEMINFO,
+	__INET_DIAG_EXT2,
 };
 
 #define INET_DIAG_MAX INET_DIAG_SKMEMINFO
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 535584c..52db768 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -81,6 +81,9 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
 	const struct inet_diag_handler *handler;
 	int ext = req->idiag_ext;
 
+	if (ext & (1 << (__INET_DIAG_EXT2 - 1)))
+		ext |= req->idiag_ext2 << __INET_DIAG_EXT2;
+
 	handler = inet_diag_table[req->sdiag_protocol];
 	BUG_ON(handler == NULL);
 
-- 
1.7.6.5

  parent reply	other threads:[~2012-10-23 16:26 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 ` Pavel Emelyanov [this message]
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

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=5086C51C.7040403@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.