netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Varun Chandramohan <varunc@linux.vnet.ibm.com>
Cc: netdev@vger.kernel.org
Subject: Re: [IPROUTE2][PATCH 2/2] Enable Type Labels For "ip monitor all"
Date: Fri, 27 Mar 2009 11:28:59 -0700	[thread overview]
Message-ID: <20090327112859.1624a0ce@nehalam> (raw)
In-Reply-To: <20090312134243.1b15fc2c.varunc@linux.vnet.ibm.com>

On Thu, 12 Mar 2009 13:42:43 +0530
Varun Chandramohan <varunc@linux.vnet.ibm.com> wrote:

> This patch adds prefix lables for "ip monitor all" command to simplfy
> understanding of the output.
> 
> Signed-off-by: Varun Chandramohan <varunc@linux.vnet.ibm.com>
> ---
>  ip/ipmonitor.c |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
> 
> diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c
> index a74730e..baf25a8 100644
> --- a/ip/ipmonitor.c
> +++ b/ip/ipmonitor.c
> @@ -25,6 +25,7 @@
>  #include "ip_common.h"
>  
>  static void usage(void) __attribute__((noreturn));
> +int prefix_banner;
>  
>  static void usage(void)
>  {
> @@ -42,31 +43,45 @@ int accept_msg(const struct sockaddr_nl *who,
>  		print_timestamp(fp);
>  
>  	if (n->nlmsg_type == RTM_NEWROUTE || n->nlmsg_type == RTM_DELROUTE) {
> +		if (prefix_banner)
> +			fprintf(fp, "[ROUTE]");
>  		print_route(who, n, arg);
>  		return 0;
>  	}
>  	if (n->nlmsg_type == RTM_NEWLINK || n->nlmsg_type == RTM_DELLINK) {
>  		ll_remember_index(who, n, NULL);
> +		if (prefix_banner)
> +			fprintf(fp, "[LINK]");
>  		print_linkinfo(who, n, arg);
>  		return 0;
>  	}
>  	if (n->nlmsg_type == RTM_NEWADDR || n->nlmsg_type == RTM_DELADDR) {
> +		if (prefix_banner)
> +			fprintf(fp, "[ADDR]");
>  		print_addrinfo(who, n, arg);
>  		return 0;
>  	}
>  	if (n->nlmsg_type == RTM_NEWADDRLABEL || n->nlmsg_type == RTM_DELADDRLABEL) {
> +		if (prefix_banner)
> +			fprintf(fp, "[ADDRLABEL]");
>  		print_addrlabel(who, n, arg);
>  		return 0;
>  	}
>  	if (n->nlmsg_type == RTM_NEWNEIGH || n->nlmsg_type == RTM_DELNEIGH) {
> +		if (prefix_banner)
> +			fprintf(fp, "[NEIGH]");
>  		print_neigh(who, n, arg);
>  		return 0;
>  	}
>  	if (n->nlmsg_type == RTM_NEWPREFIX) {
> +		if (prefix_banner)
> +			fprintf(fp, "[PREFIX]");
>  		print_prefix(who, n, arg);
>  		return 0;
>  	}
>  	if (n->nlmsg_type == RTM_NEWRULE || n->nlmsg_type == RTM_DELRULE) {
> +		if (prefix_banner)
> +			fprintf(fp, "[RULE]");
>  		print_rule(who, n, arg);
>  		return 0;
>  	}
> @@ -130,6 +145,7 @@ int do_ipmonitor(int argc, char **argv)
>  			groups = 0;		
>  		} else if (strcmp(*argv, "all") == 0) {
>  			groups = ~RTMGRP_TC;
> +			prefix_banner=1;
>  		} else if (matches(*argv, "help") == 0) {
>  			usage();
>  		} else {

applied

      reply	other threads:[~2009-03-27 18:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-12  8:12 [IPROUTE2][PATCH 2/2] Enable Type Labels For "ip monitor all" Varun Chandramohan
2009-03-27 18:28 ` Stephen Hemminger [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=20090327112859.1624a0ce@nehalam \
    --to=shemminger@vyatta.com \
    --cc=netdev@vger.kernel.org \
    --cc=varunc@linux.vnet.ibm.com \
    /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).