[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180208162154.4prs5hxxx47jxjvn@salvia>
Date: Thu, 8 Feb 2018 17:21:54 +0100
From: Pablo Neira Ayuso <pablo@...filter.org>
To: Randy Dunlap <rdunlap@...radead.org>
Cc: netfilter-devel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH RFC 2/4] netlink: add generic object description
infrastructure
Hi Randy,
On Wed, Feb 07, 2018 at 05:28:20PM -0800, Randy Dunlap wrote:
[...]
> > diff --git a/include/net/nldesc.h b/include/net/nldesc.h
> > new file mode 100644
> > index 000000000000..19306a648f10
> > --- /dev/null
> > +++ b/include/net/nldesc.h
> > @@ -0,0 +1,160 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +#ifndef __NET_NLDESC_H
> > +#define __NET_NLDESC_H
> > +
> > +#include <linux/types.h>
> > +
> > +struct nl_desc_cmd;
> > +struct nl_desc_obj;
> > +
> > +struct nl_desc_cmds {
> > + int max;
> > + const struct nl_desc_cmd *table;
> > +};
> > +
> > +struct nl_desc_objs {
> > + int max;
> > + const struct nl_desc_obj **table;
> > +};
> > +
> > +struct nl_desc_req {
> > + u32 bus;
> > +};
> > +
> > +struct net;
> > +struct sk_buff;
> > +struct nlmsghdr;
> > +struct nlattr;
> > +
>
> > +
> > +/**
> > + * struct nl_desc_obj - netlink object description
> > + * @id: unique ID to identify this netlink object
> > + * @max: number of attributes to describe this object
>
> @attr_max:
Thanks for spotting this.
> > + * @attrs: array of attribute descriptions
> > + */
> > +struct nl_desc_obj {
> > + u16 id;
> > + u16 attr_max;
> > + const struct nl_desc_attr *attrs;
> > +};
>
>
> Is there a test program for this?
I'm attaching what I have used to test this. These files print the
netlink bus description.
> Maybe add it to tools/testing/ ?
Yes, I can place it there, no problem. This userspace code depends on
libmnl though.
I was planning to add infrastructure to libmnl to add a couple of helper
functions that allows us to populate the nl_desc cache and to look up
for presence of commands/attributes.
People that don't like libmnl for whatever reason can add similar code
to their libraries too, of course.
Thanks!
View attachment "0001-examples-add-netlink-bus-description.patch" of type "text/x-diff" (12200 bytes)
Powered by blists - more mailing lists