* [PATCH iproute2 1/3] ctrl: Fix fd leak in ctrl_listen()
@ 2024-02-08 17:26 Stephen Hemminger
2024-02-08 17:26 ` [PATCH iproute2 2/3] ip: detect errors in netconf monitor mode Stephen Hemminger
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Stephen Hemminger @ 2024-02-08 17:26 UTC (permalink / raw)
To: netdev; +Cc: Maks Mishin, Maks Mishin, Stephen Hemminger
From: Maks Mishin <maks.mishinfz@gmail.com>
Use the same pattern for handling rtnl_listen() errors that
is used across other iproute2 commands. All other commands
exit with status of 2 if rtnl_listen fails.
Reported-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
genl/ctrl.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/genl/ctrl.c b/genl/ctrl.c
index bae73a54bc37..72a9b01302cf 100644
--- a/genl/ctrl.c
+++ b/genl/ctrl.c
@@ -334,8 +334,9 @@ static int ctrl_listen(int argc, char **argv)
}
if (rtnl_listen(&rth, print_ctrl, (void *) stdout) < 0)
- return -1;
-
+ exit(2);
+
+ rtnl_close(&rth);
return 0;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH iproute2 2/3] ip: detect errors in netconf monitor mode
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
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
2 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2024-02-08 17:26 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH iproute2 3/3] ip: detect rtnl_listen errors while monitoring netns
2024-02-08 17:26 [PATCH iproute2 1/3] ctrl: Fix fd leak in ctrl_listen() Stephen Hemminger
2024-02-08 17:26 ` [PATCH iproute2 2/3] ip: detect errors in netconf monitor mode Stephen Hemminger
@ 2024-02-08 17:26 ` Stephen Hemminger
2024-02-09 16:50 ` [PATCH iproute2 1/3] ctrl: Fix fd leak in ctrl_listen() patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2024-02-08 17:26 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
If rtnl_listen detects error (such as netlink socket EOF),
then exit with status 2 like other iproute2 monitor commands.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
ip/ipnetns.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ip/ipnetns.c b/ip/ipnetns.c
index 0ae46a874a0c..594b2ef15d0c 100644
--- a/ip/ipnetns.c
+++ b/ip/ipnetns.c
@@ -96,7 +96,8 @@ static int ipnetns_have_nsid(void)
close(fd);
return 0;
}
- rtnl_listen(&rth, ipnetns_accept_msg, NULL);
+ if (rtnl_listen(&rth, ipnetns_accept_msg, NULL) < 0)
+ exit(2);
close(fd);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH iproute2 1/3] ctrl: Fix fd leak in ctrl_listen()
2024-02-08 17:26 [PATCH iproute2 1/3] ctrl: Fix fd leak in ctrl_listen() Stephen Hemminger
2024-02-08 17:26 ` [PATCH iproute2 2/3] ip: detect errors in netconf monitor mode Stephen Hemminger
2024-02-08 17:26 ` [PATCH iproute2 3/3] ip: detect rtnl_listen errors while monitoring netns Stephen Hemminger
@ 2024-02-09 16:50 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-02-09 16:50 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev, maks.mishinfz, maks.mishinFZ
Hello:
This series was applied to iproute2/iproute2.git (main)
by Stephen Hemminger <stephen@networkplumber.org>:
On Thu, 8 Feb 2024 09:26:27 -0800 you wrote:
> From: Maks Mishin <maks.mishinfz@gmail.com>
>
> Use the same pattern for handling rtnl_listen() errors that
> is used across other iproute2 commands. All other commands
> exit with status of 2 if rtnl_listen fails.
>
> Reported-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
>
> [...]
Here is the summary with links:
- [iproute2,1/3] ctrl: Fix fd leak in ctrl_listen()
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=f4dc6a784f6e
- [iproute2,2/3] ip: detect errors in netconf monitor mode
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=00e8a64dac3b
- [iproute2,3/3] ip: detect rtnl_listen errors while monitoring netns
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=8f340a075138
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-09 16:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-08 17:26 [PATCH iproute2 1/3] ctrl: Fix fd leak in ctrl_listen() Stephen Hemminger
2024-02-08 17:26 ` [PATCH iproute2 2/3] ip: detect errors in netconf monitor mode Stephen Hemminger
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
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).