From: "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
To: "davem@davemloft.net" <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"xiyou.wangcong@gmail.com" <xiyou.wangcong@gmail.com>
Subject: Re: [PATCH v2] net: inet: diag: expose sockets cgroup classid
Date: Wed, 16 Aug 2017 20:13:02 +0000 [thread overview]
Message-ID: <20170816201707.xbpquud3ar3uarst@sasha-lappy> (raw)
In-Reply-To: <20170727181352.18547-1-alexander.levin@verizon.com>
Ping?
On Thu, Jul 27, 2017 at 02:13:52PM -0400, Sasha Levin wrote:
>This is useful for directly looking up a task based on class id rather than
>having to scan through all open file descriptors.
>
>Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
>---
>
>Changes in V2:
> - Addressed comments from Cong Wang (use nla_put_u32())
>
> include/uapi/linux/inet_diag.h | 1 +
> net/ipv4/inet_diag.c | 10 ++++++++++
> 2 files changed, 11 insertions(+)
>
>diff --git a/include/uapi/linux/inet_diag.h b/include/uapi/linux/inet_diag.h
>index bbe201047df6..678496897a68 100644
>--- a/include/uapi/linux/inet_diag.h
>+++ b/include/uapi/linux/inet_diag.h
>@@ -142,6 +142,7 @@ enum {
> INET_DIAG_PAD,
> INET_DIAG_MARK,
> INET_DIAG_BBRINFO,
>+ INET_DIAG_CLASS_ID,
> __INET_DIAG_MAX,
> };
>
>diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
>index 3828b3a805cd..2c2445d4bb58 100644
>--- a/net/ipv4/inet_diag.c
>+++ b/net/ipv4/inet_diag.c
>@@ -274,6 +274,16 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
> goto errout;
> }
>
>+ if (ext & (1 << (INET_DIAG_CLASS_ID - 1))) {
>+ u32 classid = 0;
>+
>+#ifdef CONFIG_SOCK_CGROUP_DATA
>+ classid = sock_cgroup_classid(&sk->sk_cgrp_data);
>+#endif
>+
>+ nla_put_u32(skb, INET_DIAG_CLASS_ID, classid);
>+ }
>+
> out:
> nlmsg_end(skb, nlh);
> return 0;
>--
>2.11.0
--
Thanks,
Sasha
next prev parent reply other threads:[~2017-08-16 20:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-27 18:11 [PATCH v2] net: inet: diag: expose sockets cgroup classid Levin, Alexander (Sasha Levin)
2017-07-28 3:23 ` Jakub Kicinski
2017-08-16 20:13 ` Levin, Alexander (Sasha Levin) [this message]
2017-08-16 20:15 ` Cong Wang
2017-08-17 0:28 ` Levin, Alexander (Sasha Levin)
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=20170816201707.xbpquud3ar3uarst@sasha-lappy \
--to=alexander.levin@verizon.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=xiyou.wangcong@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox