* [PATCH iproute2] iproute2: bugfix - restore ip monitor backward compatibility.
@ 2025-05-23 3:25 Yuyang Huang
2025-05-23 10:25 ` Luca Boccassi
2025-05-26 15:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Yuyang Huang @ 2025-05-23 3:25 UTC (permalink / raw)
To: Yuyang Huang
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, David Ahern, netdev, Luca Boccassi,
Maciej Żenczykowski, Lorenzo Colitti, Adel Belhouane
The current ip monitor implementation fails on older kernels that lack
newer RTNLGRP_* definitions. As ip monitor is expected to maintain
backward compatibility, this commit updates the code to check if errno
is not EINVAL when rtnl_add_nl_group() fails. This change restores ip
monitor's backward compatibility with older kernel versions.
Cc: David Ahern <dsahern@kernel.org>
Cc: Luca Boccassi <bluca@debian.org>
Cc: Maciej Żenczykowski <maze@google.com>
Cc: Lorenzo Colitti <lorenzo@google.com>
Reported-by: Adel Belhouane <bugs.a.b@free.fr>
Closes: https://lore.kernel.org/netdev/CADXeF1GgJ_1tee3hc7gca2Z21Lyi3mzxq52sSfMg3mFQd2rGWQ@mail.gmail.com/T/#t
Signed-off-by: Yuyang Huang <yuyanghuang@google.com>
---
ip/ipmonitor.c | 35 ++++++++++++++++++++++-------------
1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c
index b890b4d0..1f4e860f 100644
--- a/ip/ipmonitor.c
+++ b/ip/ipmonitor.c
@@ -5,6 +5,7 @@
* Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
*/
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -328,38 +329,46 @@ int do_ipmonitor(int argc, char **argv)
if (lmask & IPMON_LNEXTHOP &&
rtnl_add_nl_group(&rth, RTNLGRP_NEXTHOP) < 0) {
- fprintf(stderr, "Failed to add nexthop group to list\n");
- exit(1);
+ if (errno != EINVAL) {
+ fprintf(stderr, "Failed to add nexthop group to list\n");
+ exit(1);
+ }
}
if (lmask & IPMON_LSTATS &&
rtnl_add_nl_group(&rth, RTNLGRP_STATS) < 0 &&
nmask & IPMON_LSTATS) {
- fprintf(stderr, "Failed to add stats group to list\n");
- exit(1);
+ if (errno != EINVAL) {
+ fprintf(stderr, "Failed to add stats group to list\n");
+ exit(1);
+ }
}
if (lmask & IPMON_LMADDR) {
if ((!preferred_family || preferred_family == AF_INET) &&
rtnl_add_nl_group(&rth, RTNLGRP_IPV4_MCADDR) < 0) {
- fprintf(stderr,
- "Failed to add ipv4 mcaddr group to list\n");
- exit(1);
+ if (errno != EINVAL) {
+ fprintf(stderr, "Failed to add ipv4 mcaddr group to list\n");
+ exit(1);
+ }
}
if ((!preferred_family || preferred_family == AF_INET6) &&
rtnl_add_nl_group(&rth, RTNLGRP_IPV6_MCADDR) < 0) {
- fprintf(stderr,
- "Failed to add ipv6 mcaddr group to list\n");
- exit(1);
+ if (errno != EINVAL) {
+ fprintf(stderr,
+ "Failed to add ipv6 mcaddr group to list\n");
+ exit(1);
+ }
}
}
if (lmask & IPMON_LACADDR) {
if ((!preferred_family || preferred_family == AF_INET6) &&
rtnl_add_nl_group(&rth, RTNLGRP_IPV6_ACADDR) < 0) {
- fprintf(stderr,
- "Failed to add ipv6 acaddr group to list\n");
- exit(1);
+ if (errno != EINVAL) {
+ fprintf(stderr, "Failed to add ipv6 acaddr group to list\n");
+ exit(1);
+ }
}
}
--
2.49.0.1204.g71687c7c1d-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH iproute2] iproute2: bugfix - restore ip monitor backward compatibility.
2025-05-23 3:25 [PATCH iproute2] iproute2: bugfix - restore ip monitor backward compatibility Yuyang Huang
@ 2025-05-23 10:25 ` Luca Boccassi
2025-05-26 15:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Luca Boccassi @ 2025-05-23 10:25 UTC (permalink / raw)
To: Yuyang Huang
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, David Ahern, netdev, Maciej Żenczykowski,
Lorenzo Colitti, Adel Belhouane
On Fri, 23 May 2025 at 04:25, Yuyang Huang <yuyanghuang@google.com> wrote:
>
> The current ip monitor implementation fails on older kernels that lack
> newer RTNLGRP_* definitions. As ip monitor is expected to maintain
> backward compatibility, this commit updates the code to check if errno
> is not EINVAL when rtnl_add_nl_group() fails. This change restores ip
> monitor's backward compatibility with older kernel versions.
>
> Cc: David Ahern <dsahern@kernel.org>
> Cc: Luca Boccassi <bluca@debian.org>
> Cc: Maciej Żenczykowski <maze@google.com>
> Cc: Lorenzo Colitti <lorenzo@google.com>
> Reported-by: Adel Belhouane <bugs.a.b@free.fr>
> Closes: https://lore.kernel.org/netdev/CADXeF1GgJ_1tee3hc7gca2Z21Lyi3mzxq52sSfMg3mFQd2rGWQ@mail.gmail.com/T/#t
> Signed-off-by: Yuyang Huang <yuyanghuang@google.com>
> ---
> ip/ipmonitor.c | 35 ++++++++++++++++++++++-------------
> 1 file changed, 22 insertions(+), 13 deletions(-)
Thanks, can confirm this fixes the problem and ip monitor works again
with v6.12.
Tested-by: Luca Boccassi <bluca@debian.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH iproute2] iproute2: bugfix - restore ip monitor backward compatibility.
2025-05-23 3:25 [PATCH iproute2] iproute2: bugfix - restore ip monitor backward compatibility Yuyang Huang
2025-05-23 10:25 ` Luca Boccassi
@ 2025-05-26 15:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-05-26 15:20 UTC (permalink / raw)
To: Yuyang Huang
Cc: davem, edumazet, kuba, pabeni, horms, dsahern, netdev, bluca,
maze, lorenzo, bugs.a.b
Hello:
This patch was applied to iproute2/iproute2.git (main)
by Stephen Hemminger <stephen@networkplumber.org>:
On Fri, 23 May 2025 12:25:18 +0900 you wrote:
> The current ip monitor implementation fails on older kernels that lack
> newer RTNLGRP_* definitions. As ip monitor is expected to maintain
> backward compatibility, this commit updates the code to check if errno
> is not EINVAL when rtnl_add_nl_group() fails. This change restores ip
> monitor's backward compatibility with older kernel versions.
>
> Cc: David Ahern <dsahern@kernel.org>
> Cc: Luca Boccassi <bluca@debian.org>
> Cc: Maciej Żenczykowski <maze@google.com>
> Cc: Lorenzo Colitti <lorenzo@google.com>
> Reported-by: Adel Belhouane <bugs.a.b@free.fr>
> Closes: https://lore.kernel.org/netdev/CADXeF1GgJ_1tee3hc7gca2Z21Lyi3mzxq52sSfMg3mFQd2rGWQ@mail.gmail.com/T/#t
> Signed-off-by: Yuyang Huang <yuyanghuang@google.com>
>
> [...]
Here is the summary with links:
- [iproute2] iproute2: bugfix - restore ip monitor backward compatibility.
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=969817ce1ddb
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] 3+ messages in thread
end of thread, other threads:[~2025-05-26 15:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-23 3:25 [PATCH iproute2] iproute2: bugfix - restore ip monitor backward compatibility Yuyang Huang
2025-05-23 10:25 ` Luca Boccassi
2025-05-26 15:20 ` 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).