IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
Since they call tracee-specific socket/sendmsg/recvmsg, we'd like to
pass tcp there.
* defs.h (genl_families_xlat): Add tcp argument.
* netlink.c (decode_nlmsg_type_default, decode_nlmsg_type_generic,
decode_nlmsg_type_netfilter, typedef nlmsg_types_decoder_t): Likewise.
(decode_nlmsg_type): Add tcp argument. Pass tcp to decoder call.
(print_nlmsghdr): Pass tcp to the decode_nlmsg_type call.
* socketutils.c (send_query, receive_responses): Add tcp argument.
(inet_send_query, unix_send_query, netlink_send_query, ): Add tcp argument.
Pass tcp to the send_query call.
(unix_get): Add tcp argument. Pass tcp to the unix_send_query and
receive_responses calls.
(inet_get): Add tcp argument. Pass tcp to the inet_send_query and
receive_responses calls.
(tcp_v4_get, udp_v4_get, tcp_v6_get, udp_v6_get): Add tcp argument. Pass
tcp to the inet_get call.
(netlink_get): Add tcp argument. Pass tcp to the netlink_send_query and
receive_responses calls.
(protocols): Add tcp argument to the get field.
(get_sockaddr_by_inode_uncached): Add tcp argument. Pass tcp to
the protocols[].get calls.
(print_sockaddr_by_inode_uncached): Add tcp argument. Pass tcp to
the get_sockaddr_by_inode_uncached call.
(get_sockaddr_by_inode): Pass tcp to the get_sockaddr_by_inode_uncached
call.
(print_sockaddr_by_inode): Pass tcp to the
print_sockaddr_by_inode_uncached call.
(genl_send_dump_families): Add tcp argument. Pass tcp to the send_query
call.
(genl_families_xlat): Add tcp argument. Pass tcp to the
genl_send_dump_families and receive_responses calls.
Refactor decode_nlmsg_flags to make it family-specific, just like
decode_nlmsg_type and decode_payload.
* netlink.c (decode_nlmsg_flags_crypto, decode_nlmsg_flags_route,
decode_nlmsg_flags_sock_diag, decode_nlmsg_flags_xfrm): New functions.
(nlmsg_flags_decoder_t): New typedef.
(nlmsg_flags): New array.
(decode_nlmsg_flags): Use it.
The side effect of #include "xlat/nl_route_types.h" is
RTM_* constants properly defined in that header file.
While netlink.c does not use these constants itself,
netlink_route.c is going to need them soon.
* defs.h (nl_route_types): New xlat prototype.
* netlink.c: Move inclusion of "xlat/nl_route_types.h" ...
* netlink_route.c: ... here.
Prepare for decoding of NETLINK_KOBJECT_UEVENT. Messages of the latter,
unlike traditional netlink families, don't contain a header at all.
* netlink.c (NL_FAMILY_*): Remove enum.
(get_fd_nl_family): Replace NL_FAMILY_ERROR with -1.
(decode_nlmsg_type): Update the comment.
Skip family specific type decoders for type < NLMSG_MIN_TYPE.
(decode_nlmsghdr_with_payload): Skip family specific decoders
for type < NLMSG_MIN_TYPE && type != NLMSG_DONE.
(print_nlmsghdr): Move get_fd_nl_family invocation ...
(decode_nlmsghdr_with_payload): ... here.
* netlink.c: Include "nlattr.h" and "xlat/nlmsgerr_attrs.h".
(print_cookie, decode_nlmsgerr_attr_cookie): New functions.
(nlmsgerr_nla_decoders): New array.
(decode_nlmsgerr): Use it.
* xlat/nlmsgerr_attrs.in: New file.
* NEWS: Mention this.
Extended ACK reporting introduced by linux kernel commit
v4.11-rc5-1382-g2d4bc93.
* netlink.h (NLM_F_CAPPED): New macro.
* netlink.c (decode_payload): Pass
nlmsghdr->nlmsg_flags & NLM_F_CAPPED to decode_nlmsgerr.
(decode_nlmsgerr): Adjust the length pass to
decode_nlmsghdr_with_payload.
* netlink.c: Include "xlat/netlink_ack_flags.h".
(decode_nlmsg_flags): Decode ack flags when type == NLMSG_ERROR.
* xlat/netlink_ack_flags.in: New file.
* NEWS: Mention this.
* tests/netlink_protocol.c (test_ack_flags): New function, check this.
(main): Use it.
While many NLMSG_DONE messages indeed have payload containing
just one integer, there are exceptions. Handle this by passing
payloads of NLMSG_DONE messages to family specific netlink
payload decoders.
* netlink.c (print_nlmsghdr): Do not skip family detection
for nlmsg_type == NLMSG_DONE.
(decode_nlmsg_type): Skip family specific type decoders
for type == NLMSG_DONE.
(decode_nlmsg_flags): Skip family specific decoding of flags
for type == NLMSG_DONE.
(decode_netlink_sock_diag): Skip for nlmsg_type == NLMSG_DONE.
NETLINK_GENERIC is a protocol stacked on netlink protocol.
When a NETLINK_GENERIC subsystem registers its "family" name in the
kernel at run time, an integer value associated with this name is
assigned by the kernel. This integer value is specified in struct
nlmsghdr.nlmsg_type of subsequent communications with the
NETLINK_GENERIC subsystem.
This change implements decoding of NETLINK_GENERIC message types in
symbolic form, for example:
$ ./strace -yy -e 'sendto' ip tcp_metrics > /dev/null
sendto(4<NETLINK:[GENERIC:12345]>, {{len=20, type=tcp_metrics, ...
+++ exited with 0 +++
Note that type= specifying the NETLINK_GENERIC protocol family
is decoded properly.
* netlink.c (decode_nlmsg_type_generic): New function.
(nlmsg_types): Add NETLINK_GENERIC entry.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* defs.h (netlink_decoder_t): New typedef.
(DECL_NETLINK): New macro.
(decode_netlink_sock_diag): New prototype.
* netlink.c (netlink_decoders): New array.
(decode_payload): Use it to invoke netlink family specific decoders.
* netlink_sock_diag.c: New file.
* Makefile.am (strace_SOURCES): Add it.
Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
Co-authored-by: JingPiao Chen <chenjingpiao@gmail.com>
* netlink.c (decode_nlmsg_type_default, decode_nlmsg_type_netfilter):
New functions.
(nlmsg_types_decoder_t): New typedef.
(nlmsg_types): Add decoder field.
(decode_nlmsg_type): Use it.
Add printflags_ex extension over printflags64 that, similar
to printxvals, takes a NULL-terminated sequence of xlat pointers.
* defs.h (printflags_ex): New prototype.
(printflags64): Turn into a thin wrapper around printflags_ex.
* netlink.c (decode_nlmsg_flags): Use printflags_ex.
* util.c (printflags_ex): New function.
(printflags64): Remove.
* xlat/netlink_get_flags.in: Remove entries listed
in xlat/netlink_flags.in file.
* xlat/netlink_new_flags.in: Likewise.
* netlink.c: Include "xlat/netlink_get_flags.h"
and "xlat/netlink_new_flags.h".
(decode_nlmsg_flags): New function.
(print_nlmsghdr): Use it.
* xlat/netlink_get_flags.in: New file.
* xlat/netlink_new_flags.in: Likewise.
Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
Implement a pluggable mechanism of nlmsg_type decoding.
Add decoding of NETLINK_SOCK_DIAG types.
* linux/sock_diag.h (SOCK_DESTROY): New macro.
* xlat/nl_sock_diag_types.in: New file.
* netlink.c: Include xlat/nl_sock_diag_types.h.
(get_fd_nl_family, decode_nlmsg_type): New functions.
(print_nlmsghdr): Use them for nlmsg_type decoding.
Co-authored-by: Fabien Siron <fabien.siron@epita.fr>
* netlink.c (NL_FAMILY_ERROR, NL_FAMILY_DEFAULT): New constants.
(print_nlmsghdr): Add netlink family argument, change return type
to int, return family.
(decode_nlmsghdr_with_payload, decode_nlmsgerr, decode_payload): Add
netlink family argument. All callers updated.
The side effect of #include "xlat/netlink_protocols.h" is
NETLINK_* constants properly defined in that header file.
While net.c does not use these constants itself, netlink.c
is going to need them soon.
* net.c: Move inclusion of "xlat/netlink_protocols.h" ...
* netlink.c: ... here.
* netlink.c (decode_payload): Decode NLMSG_DONE messages.
* tests/netlink_protocol.c (test_nlmsg_done): New function
for checking decoding of NLMSG_DONE messages.
(main): Use it.
Remove temporary types created for transition from long
to kernel_ulong_t.
Automatically replace kernel_scno_t and kernel_ureg_t with
kernel_ulong_t using
$ git grep -El 'kernel_(scno|ureg)_t' |
xargs sed -ri 's/kernel_(scno|ureg)_t/kernel_ulong_t/g'
* kernel_types.h (kernel_scno_t, kernel_ureg_t): Remove.
All users updated.
* defs.h (decode_netlink): Change len argument type from unsigned long
to kernel_ureg_t.
* netlink.c (fetch_nlmsghdr): Likewise.
(decode_nlmsghdr_with_payload): Likewise. Change nlmsg_len variable
type from unsigned long to unsigned int.
(decode_netlink): Change the type of len argument and next_len variable
from unsigned long to kernel_ureg_t. Change nlmsg_len variable type
from unsigned long to unsigned int.
As about half of all printstr uses cases are invocations with the last
argument set to -1, create a dedicated function for this use case.
* defs.h (printstr): Rename to printstrn. All callers updated.
(printstr): New static inline function. All callers updated.
* defs.h (decode_netlink) Change address argument type
from unsigned long to kernel_ureg_t.
* netlink.c (fetch_nlmsghdr, decode_nlmsghdr_with_payload,
decode_netlink): Likewise.
Handle multipart netlink messages made of multiple struct nlmsghdr
headers with associated payload in one byte stream.
* netlink.c (fetch_nlmsghdr, print_nlmsghdr,
decode_nlmsghdr_with_payload): New functions.
(decode_netlink): Use them.
* tests/netlink_parsing.c (send_query): Check them.
Introduce a general socket netlink parser which prints the header and
a string for the remaining part of the buffer. It doesn't handle all
the netlink flags and types yet because the parser needs more
information, this will be implemented later.
* net.c (decode_sockbuf): New function.
(SYS_FUNC(send), SYS_FUNC(sendto), SYS_FUNC(recv), SYS_FUNC(recvfrom)):
Use it instead of printstr.
* msghdr.c (print_msghdr): Pass IOV_DECODE_NETLINK to tprint_iov_upto()
for netlink sockets.
* netlink.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (decode_netlink, getfdproto): New prototypes.
(iov_decode): Add IOV_DECODER_NETLINK.
* io.c (print_iovec): Use decode_netlink().
* util.c (getfdproto): Remove static keyword.
* xlat/netlink_flags.in: New file.
* xlat/netlink_types.in: New file.