From: Martin Schwenke <martin@meltin.net>
To: netdev@vger.kernel.org
Subject: [PATCH] ip monitor: Enable prefix labels when monitoring more than 1 object
Date: Thu, 15 Aug 2013 07:05:27 +1000 [thread overview]
Message-ID: <20130815070527.1df23bea@martins.ozlabs.org> (raw)
Prefix labelling is currently only activated when monitoring "all"
objects. However, the output can still be confusing when monitoring
more than 1 object, so enable prefix labels in this case.
Signed-off-by: Martin Schwenke <martin@meltin.net>
---
ip/ipmonitor.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c
index 86c473e..62401ea 100644
--- a/ip/ipmonitor.c
+++ b/ip/ipmonitor.c
@@ -146,6 +146,7 @@ int do_ipmonitor(int argc, char **argv)
int lprefix=0;
int lneigh=0;
int lnetconf=0;
+ int num_objects = 0;
rtnl_close(&rth);
ipaddr_reset_filter(1);
@@ -159,24 +160,31 @@ int do_ipmonitor(int argc, char **argv)
file = *argv;
} else if (matches(*argv, "link") == 0) {
llink=1;
+ num_objects++;
groups = 0;
} else if (matches(*argv, "address") == 0) {
laddr=1;
+ num_objects++;
groups = 0;
} else if (matches(*argv, "route") == 0) {
lroute=1;
+ num_objects++;
groups = 0;
} else if (matches(*argv, "mroute") == 0) {
lmroute=1;
+ num_objects++;
groups = 0;
} else if (matches(*argv, "prefix") == 0) {
lprefix=1;
+ num_objects++;
groups = 0;
} else if (matches(*argv, "neigh") == 0) {
lneigh = 1;
+ num_objects++;
groups = 0;
} else if (matches(*argv, "netconf") == 0) {
lnetconf = 1;
+ num_objects++;
groups = 0;
} else if (strcmp(*argv, "all") == 0) {
groups = ~RTMGRP_TC;
@@ -223,6 +231,9 @@ int do_ipmonitor(int argc, char **argv)
if (!preferred_family || preferred_family == AF_INET6)
groups |= nl_mgrp(RTNLGRP_IPV6_NETCONF);
}
+ if (num_objects > 1) {
+ prefix_banner = 1;
+ }
if (file) {
FILE *fp;
fp = fopen(file, "r");
--
1.7.10.4
Can be pulled from git://git.ozlabs.org/~martins/iproute2.git/ctdb.git
I'm not on the list so please CC: me on responses...
peace & happiness,
martin
next reply other threads:[~2013-08-14 21:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-14 21:05 Martin Schwenke [this message]
2013-08-16 6:40 ` [PATCH] ip monitor: Enable prefix labels when monitoring more than 1 object Stephen Hemminger
2013-08-16 6:52 ` Martin Schwenke
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=20130815070527.1df23bea@martins.ozlabs.org \
--to=martin@meltin.net \
--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).