* [PATCH iproute] libgenl: report a verbose error if rtnl_talk fails
@ 2025-02-28 13:34 Denis Kirjanov
2025-03-10 16:12 ` Stephen Hemminger
0 siblings, 1 reply; 2+ messages in thread
From: Denis Kirjanov @ 2025-02-28 13:34 UTC (permalink / raw)
To: stephen, dsahern; +Cc: netdev, Denis Kirjanov
Currenlty rtnl_talk() doesn't give us the reason
if it fails.
Signed-off-by: Denis Kirjanov <kirjanov@gmail.com>
---
lib/libgenl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/libgenl.c b/lib/libgenl.c
index fca07f9f..9927af84 100644
--- a/lib/libgenl.c
+++ b/lib/libgenl.c
@@ -58,7 +58,8 @@ int genl_resolve_family(struct rtnl_handle *grth, const char *family)
family, strlen(family) + 1);
if (rtnl_talk(grth, &req.n, &answer) < 0) {
- fprintf(stderr, "Error talking to the kernel\n");
+ fprintf(stderr, "Error talking to the kernel: %s (errno %d)\n",
+ strerror(errno), errno);
return -2;
}
@@ -103,7 +104,8 @@ int genl_add_mcast_grp(struct rtnl_handle *grth, __u16 fnum, const char *group)
addattr16(&req.n, sizeof(req), CTRL_ATTR_FAMILY_ID, fnum);
if (rtnl_talk(grth, &req.n, &answer) < 0) {
- fprintf(stderr, "Error talking to the kernel\n");
+ fprintf(stderr, "Error talking to the kernel: %s (errno %d)\n",
+ strerror(errno), errno);
return -2;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH iproute] libgenl: report a verbose error if rtnl_talk fails
2025-02-28 13:34 [PATCH iproute] libgenl: report a verbose error if rtnl_talk fails Denis Kirjanov
@ 2025-03-10 16:12 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2025-03-10 16:12 UTC (permalink / raw)
To: Denis Kirjanov; +Cc: dsahern, netdev
On Fri, 28 Feb 2025 16:34:31 +0300
Denis Kirjanov <kirjanov@gmail.com> wrote:
> Currenlty rtnl_talk() doesn't give us the reason
> if it fails.
>
> Signed-off-by: Denis Kirjanov <kirjanov@gmail.com>
> ---
Don't think this is needed.
- inside rtnl_talk, it already prints (using perror) if it is a kernel reported error
- lots of other places call rtnl_talk() what is special about genl
Better to move any required error prints into libnetlink.c
Even better is to make sure any errors in kernel are using extack to give
better messages.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-10 16:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-28 13:34 [PATCH iproute] libgenl: report a verbose error if rtnl_talk fails Denis Kirjanov
2025-03-10 16:12 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).