Commit Graph

3 Commits

Author SHA1 Message Date
91b87e65ff nlattr: add const qualifiers to auto variables and function arguments
This change does not affect the code generated by the compiler,
the purpose of these "const" qualifiers is to highlight the intent.

* nlattr.c (decode_nlattr_with_data, decode_nla_str, decode_nla_strn,
decode_nla_##name): Add const qualifier to tcp, addr, and len arguments.
2017-06-30 21:38:49 +00:00
JingPiao Chen
745ead6451 netlink: introduce nla_decoder_t to parse netlink attributes data
* nlattr.h (nla_decoder_t): New typedef.
(DECL_NLA): New macro.
(decode_nlattr): Add decoders, size and opaque_data argument.
* nlattr.c: (decode_nlattr_with_data): Likewise.
(decode_nla_*): New functions.
* netlink_sock_diag.c (decode_inet_diag_req_compat)
(decode_inet_diag_req_v2, decode_inet_diag_msg)
(decode_netlink_diag_msg, (decode_packet_diag_msg)
(decode_smc_diag_msg, decode_unix_diag_msg): Add decoders,
size and opaque_data arguments. All callers updated.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-06-30 21:38:49 +00:00
JingPiao Chen
d851f5695d netlink: introduce a basic netlink attributes parser
* linux/unix_diag.h (UNIX_DIAG_*): New enum.
* nlattr.c: New file.
* nlattr.h: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* netlink_sock_diag.c: Include "nlattr.h" and "xlat/unix_diag_attrs.h".
(decode_unix_diag_msg): Use decode_nlattr.
* xlat/unix_diag_attrs.in: New file.

Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
2017-06-21 16:36:33 +00:00