From: Andrew Vagin <avagin@parallels.com>
To: Thomas Graf <tgraf@suug.ch>
Cc: Andrey Vagin <avagin@openvz.org>, <linux-kernel@vger.kernel.org>,
<netdev@vger.kernel.org>, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Pavel Emelyanov <xemul@parallels.com>,
Pablo Neira Ayuso <pablo@netfilter.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Gao feng <gaofeng@cn.fujitsu.com>
Subject: Re: [PATCH 2/2] netlink: Diag core and basic socket info dumping
Date: Thu, 21 Mar 2013 18:31:19 +0400 [thread overview]
Message-ID: <20130321143119.GA14763@paralelels.com> (raw)
In-Reply-To: <20130321125230.GB9046@casper.infradead.org>
On Thu, Mar 21, 2013 at 12:52:30PM +0000, Thomas Graf wrote:
> On 03/21/13 at 01:21pm, Andrey Vagin wrote:
> > diff --git a/include/uapi/linux/netlink_diag.h b/include/uapi/linux/netlink_diag.h
> > new file mode 100644
> > index 0000000..9328866
> > --- /dev/null
> > +++ b/include/uapi/linux/netlink_diag.h
> > +enum {
> > + NETLINK_DIAG_MEMINFO,
> > + NETLINK_DIAG_GROUPS,
> > +
> > + NETLINK_DIAG_MAX,
> > +};
>
> Please follow the common pattern and define NETLINK_DIAG_MAX as
> NETLINK_DIAG_GROUPS like other by doing>
>
> [...]
> __NETLINK_DIAG_MAX,
> };
>
> #define NETLINK_DIAG_MAX (__NETLINK_DIAG_MAX - 1)
>
> Everyone is used to do:
>
> struct nlattr *attrs[NETLINK_DIAG_MAX+1];
>
> nla_parse([...], NETLINK_DIAG_MAX, [...]
>
Thank you for this issue. I sent the separate patch
"[PATCH] net: fix *_DIAG_MAX constants", because currently only
INET_DIAG_MAX is correct.
> In fact, the follow-up patch to ss is buggy because of this.
> UNIX_DIAG_MAX suffers from the same problem which is problem the
> cause for this.
The code in ss looks like you described:
struct rtattr *tb[UNIX_DIAG_MAX+1];
...
parse_rtattr(tb, UNIX_DIAG_MAX, (struct rtattr*)(r+1),
nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*r)));
struct rtattr *tb[NETLINK_DIAG_MAX+1];
...
parse_rtattr(tb, NETLINK_DIAG_MAX, (struct rtattr*)(r+1),
nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*r)))
I think I should only update headers... Or I don't understand something.
next prev parent reply other threads:[~2013-03-21 14:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-21 9:21 [PATCH 0/2] netlink: implement socket diag for netlink sockets Andrey Vagin
2013-03-21 9:21 ` [PATCH 1/2] net: prepare netlink code for netlink diag Andrey Vagin
2013-03-21 9:21 ` [PATCH 2/2] netlink: Diag core and basic socket info dumping Andrey Vagin
2013-03-21 11:46 ` Pavel Emelyanov
2013-03-21 12:52 ` Thomas Graf
2013-03-21 14:31 ` Andrew Vagin [this message]
2013-03-21 14:41 ` Thomas Graf
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=20130321143119.GA14763@paralelels.com \
--to=avagin@parallels.com \
--cc=avagin@openvz.org \
--cc=davem@davemloft.net \
--cc=ebiederm@xmission.com \
--cc=edumazet@google.com \
--cc=gaofeng@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=tgraf@suug.ch \
--cc=xemul@parallels.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