From: Martin Schwenke <martin@meltin.net>
To: netdev@vger.kernel.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH] ip: Add label option to ip monitor
Date: Mon, 19 Aug 2013 15:43:30 +1000 [thread overview]
Message-ID: <20130819154330.77c29d55@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 add an option to always print prefix labels.
Signed-off-by: Martin Schwenke <martin@meltin.net>
---
Really a reply to http://www.spinics.net/lists/netdev/msg246739.html
doc/ip-cref.tex | 16 +++++++++-------
ip/ipmonitor.c | 4 +++-
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/doc/ip-cref.tex b/doc/ip-cref.tex
index d8fed66..f062b3a 100644
--- a/doc/ip-cref.tex
+++ b/doc/ip-cref.tex
@@ -2542,13 +2542,15 @@ Namely,
the \verb|monitor| command is the first in the command line and then
the object list follows:
\begin{verbatim}
- ip monitor [ file FILE ] [ all | OBJECT-LIST ]
-\end{verbatim}
-\verb|OBJECT-LIST| is the list of object types that we want to monitor.
-It may contain \verb|link|, \verb|address| and \verb|route|.
-If no \verb|file| argument is given, \verb|ip| opens RTNETLINK,
-listens on it and dumps state changes in the format described
-in previous sections.
+ ip monitor [ file FILE ] [ all | OBJECT-LIST ] [ label ]
+\end{verbatim}
+\verb|OBJECT-LIST| is the list of object types that we want to
+monitor. It may contain \verb|link|, \verb|address| and \verb|route|.
+Specifying \verb|label| indicates that output lines should be labelled
+with the type of object being printed --- this happens by default if
+\verb|all| is specified. If no \verb|file| argument is given,
+\verb|ip| opens RTNETLINK, listens on it and dumps state changes in
+the format described in previous sections.
If a file name is given, it does not listen on RTNETLINK,
but opens the file containing RTNETLINK messages saved in binary format
diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c
index 86c473e..4895390 100644
--- a/ip/ipmonitor.c
+++ b/ip/ipmonitor.c
@@ -29,7 +29,7 @@ int prefix_banner;
static void usage(void)
{
- fprintf(stderr, "Usage: ip monitor [ all | LISTofOBJECTS ] [ FILE ]\n");
+ fprintf(stderr, "Usage: ip monitor [ all | LISTofOBJECTS ] [ FILE ] [ label ]\n");
fprintf(stderr, "LISTofOBJECTS := link | address | route | mroute | prefix |\n");
fprintf(stderr, " neigh | netconf\n");
fprintf(stderr, "FILE := file FILENAME\n");
@@ -157,6 +157,8 @@ int do_ipmonitor(int argc, char **argv)
if (matches(*argv, "file") == 0) {
NEXT_ARG();
file = *argv;
+ } else if (matches(*argv, "label") == 0) {
+ prefix_banner = 1;
} else if (matches(*argv, "link") == 0) {
llink=1;
groups = 0;
--
1.7.10.4
next reply other threads:[~2013-08-19 5:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-19 5:43 Martin Schwenke [this message]
2013-08-19 15:58 ` [PATCH] ip: Add label option to ip monitor Stephen Hemminger
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=20130819154330.77c29d55@martins.ozlabs.org \
--to=martin@meltin.net \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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).