[PATCH 0/6] Decode family field of Netlink GENERIC protocol
Dmitry V. Levin
ldv at altlinux.org
Sat Jun 10 18:03:09 UTC 2017
On Sat, Jun 10, 2017 at 03:32:41PM +0900, Masatake YAMATO wrote:
> Netlink GENERIC protocol allows a process to talk with a subsystem of
> Linux kernel specified by its name(family name); the process asks the
> id(family id)for the name first, then talks to the subsystem with the
> id. The id is defined at run-time, when the subsystem is
> registered. Therefore strace cannot make a table mapping from a family
> id to its family name in build-time.
>
> These change sets are for decoding family ids.
> strace gets the mapping and makes the table at run-time.
>
> Following case is not considered yet.
> The target process it self can ask registering a subsystem not
> registered yet to Linux kernel. When strace detects such action of the
> target process, strace should extend the table for decoding the family id
> of the newly registered subsystem.
>
> Masatake YAMATO (6):
> socketeutils: extend receive_responses() to handle other type than
> SOCK_DIAG_BY_FAMILY communication
> socketeutils: allow to pass a user data to the callback function of
> receive_responses()
> dyxlat: building xlat dynamically
> socketutils: build a xlat table dynamically for decoding "family"
> field of Netlink GENERIC protocol
> netlink: decode "family" field of Netlink GENERIC protocol
> tests: add check for decoding family field of netlink GENERIC protocol
>
> Makefile.am | 1 +
> defs.h | 10 ++++
> dyxlat.c | 120 +++++++++++++++++++++++++++++++++++++++
> netlink.c | 10 +++-
> socketutils.c | 134 +++++++++++++++++++++++++++++++++++++++-----
> tests/.gitignore | 1 +
> tests/gen_tests.in | 1 +
> tests/netlink_generic.c | 78 ++++++++++++++++++++++++++
> tests/pure_executables.list | 1 +
> 9 files changed, 338 insertions(+), 18 deletions(-)
> create mode 100644 dyxlat.c
> create mode 100644 tests/netlink_generic.c
Great! Could you fix the following formatting issues reported by kernel's
checkpatch.pl script, please?
$ kernel/scripts/checkpatch.pl 0001-socketeutils-extend-receive_responses-to-handle-othe.patch
WARNING: line over 80 characters
#51: FILE: socketutils.c:400:
+ && receive_responses(fd, inode, SOCK_DIAG_BY_FAMILY, "UNIX", unix_parse_response)
WARNING: line over 80 characters
#60: FILE: socketutils.c:409:
+ && receive_responses(fd, inode, SOCK_DIAG_BY_FAMILY, proto_name, inet_parse_response)
$ kernel/scripts/checkpatch.pl 0002-socketeutils-allow-to-pass-a-user-data-to-the-callba.patch
WARNING: line over 80 characters
#40: FILE: socketutils.c:138:
+ const int data_len, const unsigned long inode, void *user_data)
WARNING: Unnecessary space before function pointer name
#54: FILE: socketutils.c:195:
+ int (* parser) (const void *,
WARNING: Unnecessary space before function pointer arguments
#54: FILE: socketutils.c:195:
+ int (* parser) (const void *,
WARNING: line over 80 characters
#103: FILE: socketutils.c:405:
+ && receive_responses(fd, inode, SOCK_DIAG_BY_FAMILY, (void *)"UNIX", unix_parse_response)
WARNING: line over 80 characters
#112: FILE: socketutils.c:414:
+ && receive_responses(fd, inode, SOCK_DIAG_BY_FAMILY, (void *)proto_name, inet_parse_response)
WARNING: line over 80 characters
#121: FILE: socketutils.c:446:
+ && receive_responses(fd, inode, SOCK_DIAG_BY_FAMILY, (void *)"NETLINK",
$ kernel/scripts/checkpatch.pl 0003-dyxlat-building-xlat-dynamically.patch
WARNING: space prohibited between function name and open parenthesis '('
#53: FILE: defs.h:1024:
+struct dyxlat *dyxlat_new (int allocation);
WARNING: space prohibited between function name and open parenthesis '('
#54: FILE: defs.h:1025:
+void dyxlat_delete (struct dyxlat *dyxlat);
WARNING: space prohibited between function name and open parenthesis '('
#55: FILE: defs.h:1026:
+struct xlat *dyxlat_get (struct dyxlat *dyxlat);
WARNING: space prohibited between function name and open parenthesis '('
#56: FILE: defs.h:1027:
+void dyxlat_may_add_pair (struct dyxlat *dyxlat, uint64_t val, const char *str);
ERROR: spaces required around that '?' (ctx:VxW)
#108: FILE: dyxlat.c:45:
+ dyxlat->allocated = allocation? allocation: 10;
ERROR: spaces required around that ':' (ctx:VxW)
#108: FILE: dyxlat.c:45:
+ dyxlat->allocated = allocation? allocation: 10;
ERROR: space required before the open parenthesis '('
#155: FILE: dyxlat.c:92:
+ if(dyxlat->used == dyxlat->allocated) {
ERROR: space prohibited before open square bracket '['
#161: FILE: dyxlat.c:98:
+ dyxlat->xlat [dyxlat->used - 2].val = val;
ERROR: space prohibited before open square bracket '['
#162: FILE: dyxlat.c:99:
+ dyxlat->xlat [dyxlat->used - 2].str = xstrdup(str);
ERROR: space prohibited before open square bracket '['
#172: FILE: dyxlat.c:109:
+ if (dyxlat->xlat [i].val == val) {
ERROR: space prohibited before open square bracket '['
#173: FILE: dyxlat.c:110:
+ if (strcmp(dyxlat->xlat [i].str, str) == 0)
WARNING: else is not generally useful after a break or return
#175: FILE: dyxlat.c:112:
+ return;
+ else {
ERROR: space prohibited before open square bracket '['
#176: FILE: dyxlat.c:113:
+ free((void *)(dyxlat->xlat [i].str));
ERROR: space prohibited before open square bracket '['
#177: FILE: dyxlat.c:114:
+ dyxlat->xlat [i].str = xstrdup(str);
$ kernel/scripts/checkpatch.pl 0004-socketutils-build-a-xlat-table-dynamically-for-decod.patch
WARNING: space prohibited between function name and open parenthesis '('
#113: FILE: socketutils.c:610:
+ dyxlat_may_add_pair (dyxlat, id, name);
WARNING: space prohibited between function name and open parenthesis '('
#115: FILE: socketutils.c:612:
+ free (name);
WARNING: labels should not be indented
#142: FILE: socketutils.c:639:
+ out:
$ kernel/scripts/checkpatch.pl 0005-netlink-decode-family-field-of-Netlink-GENERIC-proto.patch
ERROR: "foo * bar" should be "foo *bar"
#37: FILE: netlink.c:104:
+ const struct xlat * xlat;
ERROR: space prohibited before open square bracket '['
#55: FILE: netlink.c:123:
+ if (!nlmsg_types [NETLINK_GENERIC].xlat)
ERROR: space prohibited before open square bracket '['
#56: FILE: netlink.c:124:
+ nlmsg_types [NETLINK_GENERIC].xlat = genl_families_xlat();
$ kernel/scripts/checkpatch.pl 0006-tests-add-check-for-decoding-family-field-of-netlink.patch
WARNING: Block comments use * on subsequent lines
#92: FILE: tests/netlink_generic.c:41:
+ /* Though GENL_ID_CTRL is statically given in this test case,
+ strace doesn't have knowledge that the human readable name
WARNING: Block comments use a trailing */ on a separate line
#95: FILE: tests/netlink_generic.c:44:
+ from run-time environment. */
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170610/7e9b3e56/attachment.bin>
More information about the Strace-devel
mailing list