[PATCH] Add netlink domain sockets support to socketutils
Fabien Siron
fabien.siron at epita.fr
Sun May 15 10:33:08 UTC 2016
Quoting Masatake YAMATO (2016-05-15 06:45:12)
> On Sun, 15 May 2016 02:27:36 +0300, "Dmitry V. Levin" <ldv at altlinux.org> wrote:
> >> + if (netlink_proto) {
> >> + if (asprintf(&details, "%s:[%s]", proto_name,
> >> + netlink_proto) < 0)
> >
> > I've tried this with "ip l" command, and it printed
> > <NETLINK:[NETLINK_ROUTE]>, which looks redundant.
> >
> > Wouldn't it be more useful to print just netlink_proto but also add more
> > netlink specific information, e.g. <NETLINK_ROUTE:[ndiag_portid]>?
>
> How about <NETLINK:[ROUTE]> ?
>
> `NETLINK_' prefix comes from netlink_protocols.h.
> As far as seeing the contents of netlink_protocols array,
> it seems that all entries have the same prefix.
> The prefix can be trimmed before build a string which will be cached:
>
> + if (netlink_proto) {
> ++ if (has_prefix (netlink_proto, "NETLINK_"))
> ++ netlink_proto += netlink_proto + strlen ("NETLINK_");
> + if (asprintf(&details, "%s:[%s]", proto_name,
> + netlink_proto) < 0)
> + return -1;
> + } else {
I agree, I think that <NETLINK:[ROUTE:ndiag_portid]> is clearer than
<NETLINK_ROUTE:[ndiag_portid]>.
Cheers,
--
Fabien Siron
More information about the Strace-devel
mailing list