Re: [PATCH 2/2] genl: ctrl: support dumping netlink policy

2020-08-24 Thread David Ahern
On 8/24/20 1:54 AM, Johannes Berg wrote: > Arguably, pretty much all of the code here should go into libnetlink > then, since the kernel facility was expressly written in a way that > would allow dumping out arbitrary (not just generic netlink) policies, > just needs wiring up in the appropriate ne

Re: [PATCH 2/2] genl: ctrl: support dumping netlink policy

2020-08-24 Thread Johannes Berg
On Sun, 2020-08-23 at 19:45 -0600, David Ahern wrote: > On 8/19/20 4:29 AM, Johannes Berg wrote: > > @@ -100,6 +102,30 @@ static int print_ctrl_grp(FILE *fp, struct rtattr > > *arg, __u32 ctrl_ver) > > > > } > > > > +static const char *get_nla_type_str(unsigned int attr) > > +{ > > + switch

Re: [PATCH 2/2] genl: ctrl: support dumping netlink policy

2020-08-23 Thread David Ahern
On 8/19/20 4:29 AM, Johannes Berg wrote: > @@ -100,6 +102,30 @@ static int print_ctrl_grp(FILE *fp, struct rtattr *arg, > __u32 ctrl_ver) > > } > > +static const char *get_nla_type_str(unsigned int attr) > +{ > + switch (attr) { > +#define C(x) case NL_ATTR_TYPE_ ## x: return #x > + C

[PATCH 2/2] genl: ctrl: support dumping netlink policy

2020-08-19 Thread Johannes Berg
Support dumping the netlink policy of a given generic netlink family, the policy (with any sub-policies if appropriate) is exported by the kernel in a general fashion. Signed-off-by: Johannes Berg --- genl/ctrl.c | 91 + 1 file changed, 85 inse