All of lore.kernel.org
 help / color / mirror / Atom feed
From: "William A. Kennington III" <william@wkennington.com>
To: netdev@vger.kernel.org
Cc: "William A. Kennington III" <william@wkennington.com>
Subject: [PATCH iproute2-next 2/2] ip-monitor: Always monitor links
Date: Thu, 31 Jul 2025 14:59:20 -0700	[thread overview]
Message-ID: <20250731215920.3675217-2-william@wkennington.com> (raw)
In-Reply-To: <20250731215920.3675217-1-william@wkennington.com>

We need to watch link changes even if we don't actively print them.
Otherwise, route changes will not print the correct link name.

Signed-off-by: William A. Kennington III <william@wkennington.com>
---
 ip/ipmonitor.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c
index 1f4e860f..14aba1f1 100644
--- a/ip/ipmonitor.c
+++ b/ip/ipmonitor.c
@@ -25,6 +25,7 @@ static int prefix_banner;
 int listen_all_nsid;
 struct rtnl_ctrl_data *ctrl_data;
 int do_monitor;
+int print_link;
 
 static void usage(void)
 {
@@ -100,7 +101,8 @@ static int accept_msg(struct rtnl_ctrl_data *ctrl,
 	case RTM_NEWLINK:
 	case RTM_DELLINK:
 		ll_remember_index(n, NULL);
-		print_linkinfo(n, arg);
+		if (print_link)
+			print_linkinfo(n, arg);
 		return 0;
 
 	case RTM_NEWADDR:
@@ -263,8 +265,10 @@ int do_ipmonitor(int argc, char **argv)
 	if (!lmask)
 		lmask = IPMON_L_ALL;
 
+	/* Always monitor links for renaming */
+	groups |= nl_mgrp(RTNLGRP_LINK);
 	if (lmask & IPMON_LLINK)
-		groups |= nl_mgrp(RTNLGRP_LINK);
+		print_link = true;
 	if (lmask & IPMON_LADDR) {
 		if (!preferred_family || preferred_family == AF_INET)
 			groups |= nl_mgrp(RTNLGRP_IPV4_IFADDR);
-- 
2.50.1.565.gc32cd1483b-goog


      reply	other threads:[~2025-07-31 21:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31 21:59 [PATCH iproute2-next 1/2] lib/ll_map: Update name when changed William A. Kennington III
2025-07-31 21:59 ` William A. Kennington III [this message]

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=20250731215920.3675217-2-william@wkennington.com \
    --to=william@wkennington.com \
    --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 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.