netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sridhar Samudrala <sri@us.ibm.com>
To: Patrick McHardy <kaber@trash.net>
Cc: Stephen Hemminger <shemminger@linux-foundation.org>,
	netdev@vger.kernel.org
Subject: Re: [PATCH] IPROUTE2: Fix bug  in display of ipv6 cloned/cached routes
Date: Thu, 12 Jul 2007 12:20:44 -0700	[thread overview]
Message-ID: <1184268044.12609.21.camel@localhost.localdomain> (raw)
In-Reply-To: <4695257E.8080105@trash.net>

On Wed, 2007-07-11 at 20:46 +0200, Patrick McHardy wrote:
> Sridhar Samudrala wrote:
> > This patch fixes a bug in the 'ip' command to display 
> > IPv6 cloned routes.
> >   ip -6 route ls cache
> > returns empty even when there are cloned routes because of
> > of a missing else in print_route() routine.
> 
> 
> Looks good. The ip6_multiple_tables case seems to be missing
> filtering for cloned entries entirely, would you mind adding
> that as well?
> 

I found an issue with my original patch. If cache/cloned is 
specified, it dumps the cloned routes irrespective of the table
specified. I think this is a better fix and also should address
the case you were mentioning above.

Thanks
Sridhar

Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>

diff --git a/ip/iproute.c b/ip/iproute.c
index 6fe4a70..9694bc7 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -178,7 +178,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
 				return 0;
 		}
 		if (filter.tb) {
-			if (r->rtm_flags&RTM_F_CLONED)
+			if (!filter.cloned && r->rtm_flags&RTM_F_CLONED)
 				return 0;
 			if (filter.tb == RT_TABLE_LOCAL) {
 				if (r->rtm_type != RTN_LOCAL)
@@ -191,6 +191,10 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
 			}
 		}
 	} else {
+		if (filter.cloned) {
+			if (!(r->rtm_flags&RTM_F_CLONED))
+				return 0;
+		}
 		if (filter.tb > 0 && filter.tb != table)
 			return 0;
 	}



  reply	other threads:[~2007-07-12 19:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-11 18:37 [PATCH] IPROUTE2: Fix bug in display of ipv6 cloned/cached routes Sridhar Samudrala
2007-07-11 18:46 ` Patrick McHardy
2007-07-12 19:20   ` Sridhar Samudrala [this message]
2007-07-13 12:53     ` Patrick McHardy

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=1184268044.12609.21.camel@localhost.localdomain \
    --to=sri@us.ibm.com \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@linux-foundation.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).