From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3 4/6] Add rtnetlink helper library
Date: Wed, 5 May 2021 13:26:44 +0200 [thread overview]
Message-ID: <YJKA9LQsiFDeuPUT@pevik> (raw)
In-Reply-To: <20210505081845.7024-4-mdoucha@suse.cz>
> This library provides simple interface for creating arbitrary rtnetlink
> messages with complex attributes, sending requests and receiving results.
> Changes since v1:
> - fixed error handling in tst_rtnl_create_context()
> - renamed tst_rtnl_free_context() to tst_rtnl_destroy_context()
> - switched from select() to poll() in tst_rtnl_wait()
> - use tst_rtnl_add_message() for adding NLMSG_DONE
> - receive all pending messages in tst_rtnl_recv(), not just one
> - use inline struct initialization where possible
> include/tst_rtnetlink.h | 106 +++++++++++
> lib/tst_rtnetlink.c | 407 ++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 513 insertions(+)
> create mode 100644 include/tst_rtnetlink.h
> create mode 100644 lib/tst_rtnetlink.c
> diff --git a/include/tst_rtnetlink.h b/include/tst_rtnetlink.h
> new file mode 100644
> index 000000000..12ec258f2
> --- /dev/null
> +++ b/include/tst_rtnetlink.h
> @@ -0,0 +1,106 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later
> + * Copyright (c) 2021 Linux Test Project
> + */
> +
> +#ifndef TST_RTNETLINK_H
> +#define TST_RTNETLINK_H
I guess this header will always be internal, right? (only tst_netdevice.h is
going to be used in tests) Otherwise it might need to include headers
(<linux/netlink.h>, and also <unistd.h> or <sys/types.h> for ssize_t which are
now only in C library sources).
...
> +int tst_rtnl_add_message(const char *file, const int lineno,
> + struct tst_rtnl_context *ctx, const struct nlmsghdr *header,
> + const void *payload, size_t payload_size)
> +{
> + size_t size;
> + unsigned int extra_flags = 0;
> +
> + if (!tst_rtnl_grow_buffer(file, lineno, ctx, NLMSG_SPACE(payload_size)))
Shouldn't there be an error message?
Or maybe at tst_rtnl_grow_buffer() on if (!buf)
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Nice code, thanks!
Kind regards,
Petr
next prev parent reply other threads:[~2021-05-05 11:26 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-05 8:18 [LTP] [PATCH v3 1/6] Add SAFE_REALLOC() helper function to LTP library Martin Doucha
2021-05-05 8:18 ` [LTP] [PATCH v3 2/6] Add SAFE_RECV() " Martin Doucha
2021-05-10 7:55 ` Petr Vorel
2021-05-05 8:18 ` [LTP] [PATCH v3 3/6] Add SAFE_IOCTL() variant for library code Martin Doucha
2021-05-05 9:12 ` Cyril Hrubis
2021-05-10 7:57 ` Petr Vorel
2021-05-05 8:18 ` [LTP] [PATCH v3 4/6] Add rtnetlink helper library Martin Doucha
2021-05-05 10:17 ` Petr Vorel
2021-05-05 10:25 ` Martin Doucha
2021-05-05 11:24 ` Petr Vorel
2021-05-05 11:26 ` Petr Vorel [this message]
2021-05-05 12:16 ` Cyril Hrubis
2021-05-05 20:20 ` Petr Vorel
2021-05-05 13:15 ` Martin Doucha
2021-05-05 20:24 ` Petr Vorel
2021-05-05 12:14 ` Cyril Hrubis
2021-05-10 9:07 ` Petr Vorel
2021-05-05 8:18 ` [LTP] [PATCH v3 5/6] Add helper functions for managing network interfaces Martin Doucha
2021-05-05 12:39 ` Cyril Hrubis
2021-05-05 8:18 ` [LTP] [PATCH v3 6/6] Add test for CVE 2020-25705 Martin Doucha
2021-05-05 10:04 ` Petr Vorel
2021-05-05 10:33 ` Martin Doucha
2021-05-05 11:13 ` Petr Vorel
2021-05-05 13:06 ` Cyril Hrubis
2021-05-05 15:54 ` Martin Doucha
2021-05-10 7:42 ` [LTP] [PATCH v3 1/6] Add SAFE_REALLOC() helper function to LTP library Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YJKA9LQsiFDeuPUT@pevik \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox