All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kirjanov <kirjanov@gmail.com>
To: stephen@networkplumber.org, dsahern@kernel.org
Cc: netdev@vger.kernel.org, Denis Kirjanov <kirjanov@gmail.com>
Subject: [PATCH iproute] libgenl: report a verbose error if rtnl_talk fails
Date: Fri, 28 Feb 2025 16:34:31 +0300	[thread overview]
Message-ID: <20250228133431.20296-1-kirjanov@gmail.com> (raw)

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


             reply	other threads:[~2025-02-28 13:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-28 13:34 Denis Kirjanov [this message]
2025-03-10 16:12 ` [PATCH iproute] libgenl: report a verbose error if rtnl_talk fails Stephen Hemminger

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=20250228133431.20296-1-kirjanov@gmail.com \
    --to=kirjanov@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /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.