From: Stephen Hemminger <stephen@networkplumber.org>
To: netdev@vger.kernel.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH iproute2 2/3] ip: detect errors in netconf monitor mode
Date: Thu, 8 Feb 2024 09:26:28 -0800 [thread overview]
Message-ID: <20240208172647.324168-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20240208172647.324168-1-stephen@networkplumber.org>
If rtnl_listen() returns error while looking for netconf events,
then exit with status of 2 as other iproute2 monitor actions do.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
ip/ipnetconf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ip/ipnetconf.c b/ip/ipnetconf.c
index 9ae6c45e7fd1..a0c7e051bac5 100644
--- a/ip/ipnetconf.c
+++ b/ip/ipnetconf.c
@@ -193,7 +193,8 @@ static int do_show(int argc, char **argv)
perror("Can not send request");
exit(1);
}
- rtnl_listen(&rth, print_netconf, stdout);
+ if (rtnl_listen(&rth, print_netconf, stdout) < 0)
+ exit(2);
} else {
rth.flags = RTNL_HANDLE_F_SUPPRESS_NLERR;
dump:
--
2.43.0
next prev parent reply other threads:[~2024-02-08 17:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 17:26 [PATCH iproute2 1/3] ctrl: Fix fd leak in ctrl_listen() Stephen Hemminger
2024-02-08 17:26 ` Stephen Hemminger [this message]
2024-02-08 17:26 ` [PATCH iproute2 3/3] ip: detect rtnl_listen errors while monitoring netns Stephen Hemminger
2024-02-09 16:50 ` [PATCH iproute2 1/3] ctrl: Fix fd leak in ctrl_listen() patchwork-bot+netdevbpf
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=20240208172647.324168-2-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=netdev@vger.kernel.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 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).