]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ip: Add label option to ip monitor
authorMartin Schwenke <martin@meltin.net>
Mon, 19 Aug 2013 05:43:30 +0000 (15:43 +1000)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 19 Aug 2013 15:57:24 +0000 (08:57 -0700)
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>
doc/ip-cref.tex
ip/ipmonitor.c

index d8fed66e23af19246bfb970a589894853338ad97..f062b3afe27c9fe557a0c85952c7dbad97c1af67 100644 (file)
@@ -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
index 86c473e9cfa4244a50f128dba3179d6aedb173cc..489539044b6a112376ba61f6789ce8426dcc57ee 100644 (file)
@@ -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;