From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v5 2/2] net/route: Add netlink based route change tests
Date: Wed, 29 Apr 2020 20:47:40 +0200 [thread overview]
Message-ID: <20200429184740.GA26302@dell5510> (raw)
In-Reply-To: <638d88f6-d140-8982-1555-c83c5adb83e9@oracle.com>
Hi Alexey,
> Perhaps brk_on_route_error() as it has tst_brk()?
> > char dst_str[INET6_ADDRSTRLEN], gw_str[INET6_ADDRSTRLEN];
> > tst_sock_addr(dst, sizeof(dst), dst_str, sizeof(dst_str));
> > if (gw)
> > tst_sock_addr(gw, sizeof(gw), gw_str, sizeof(gw_str));
> > tst_res(TINFO, "type: %s, iface: %d, dst: %s, gw: %s",
> > type == RTM_NEWROUTE ? "RTM_NEWROUTE" : "RTM_DELROUTE",
> > iface, dst_str, gw ? gw_str : "null");
> > tst_brk(TBROK, "failed due previous netlink errors");
> "failed due to the previous..."
> Also, what about passing the error message type and errno to this
> function, i.e. changing "TFAIL, TINFO, TBROK" to "TINFO, TFAIL"?
> static void brk_on_route_error(const char *msg, int errno, int iface, ...
> {
> ...
> tst_res(TINFO, "...");
> tst_brk(TFAIL, "%s failed (errno=%d): %s", msg, errno, strerror(errno));
...
> Then:
> brk_on_route_error("mnl_socket_open", errno, iface, dst, gw, type);
Thanks for a suggestion, that's much better.
I've just removed errno as a parameter and used it directly, because gcc complained:
route-change-netlink.c:248:41: warning: passing argument 2 of ?brk_on_route_error? makes pointer from integer without a cast [-Wint-conversion]
248 | brk_on_route_error("mnl_socket_open", errno, iface,
| ^~~~~
| |
| int
In file included from ../../../../include/tst_test.h:17,
from route-change-netlink.c:7:
route-change-netlink.c:180:53: note: expected ?int * (*)()? but argument is of type ?int?
180 | static void brk_on_route_error(const char *msg, int errno, int iface,
I'll send v6, which hopefully could be final version.
Kind regards,
Petr
prev parent reply other threads:[~2020-04-29 18:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-23 13:16 [LTP] [PATCH v5 0/2] Route tests using netlink API (dst,gw,if) Petr Vorel
2020-04-23 13:16 ` [LTP] [PATCH v5 1/2] net: Add SAFE_GETADDRINFO() Petr Vorel
2020-04-28 16:09 ` Alexey Kodanev
2020-04-23 13:16 ` [LTP] [PATCH v5 2/2] net/route: Add netlink based route change tests Petr Vorel
2020-04-28 16:54 ` Alexey Kodanev
2020-04-29 10:41 ` Petr Vorel
2020-04-29 17:04 ` Alexey Kodanev
2020-04-29 18:47 ` Petr Vorel [this message]
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=20200429184740.GA26302@dell5510 \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.