lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 24 Aug 2020 09:54:11 +0200
From:   Johannes Berg <johannes@...solutions.net>
To:     David Ahern <dsahern@...il.com>, netdev@...r.kernel.org
Cc:     Stephen Hemminger <stephen@...workplumber.org>
Subject: Re: [PATCH 2/2] genl: ctrl: support dumping netlink policy

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 (attr) {
> > +#define C(x) case NL_ATTR_TYPE_ ## x: return #x
> > +	C(U8);
> > +	C(U16);
> > +	C(U32);
> > +	C(U64);
> > +	C(STRING);
> > +	C(FLAG);
> > +	C(NESTED);
> > +	C(NESTED_ARRAY);
> > +	C(NUL_STRING);
> > +	C(BINARY);
> > +	C(S8);
> > +	C(S16);
> > +	C(S32);
> > +	C(S64);
> > +	C(BITFIELD32);
> > +	default:
> > +		return "unknown";
> > +	}
> > +}
> > +
> 
> This should go in libnetlink since it generic NLA type strings.

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 netlink family (or perhaps some
additional "policy netlink" family?)

I can make that change, but I sort of assumed it'd be nicer to do that
when someone else actually picked it up.

johannes

Powered by blists - more mailing lists