From patchwork Tue Oct 23 16:26:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Emelyanov X-Patchwork-Id: 193523 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id C1A942C0109 for ; Wed, 24 Oct 2012 03:26:14 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932946Ab2JWQ0J (ORCPT ); Tue, 23 Oct 2012 12:26:09 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:12496 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757023Ab2JWQ0I (ORCPT ); Tue, 23 Oct 2012 12:26:08 -0400 Received: from [192.168.0.103] ([89.169.95.100]) (authenticated bits=0) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id q9NGQ4tu025986 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 23 Oct 2012 20:26:04 +0400 (MSK) Message-ID: <5086C51C.7040403@parallels.com> Date: Tue, 23 Oct 2012 20:26:04 +0400 From: Pavel Emelyanov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0 MIME-Version: 1.0 To: Linux Netdev List , David Miller Subject: [PATCH 2/3] inet-diag: Get more bits for extension flag References: <5086C36B.6060508@parallels.com> In-Reply-To: <5086C36B.6060508@parallels.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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);