* [PATCH] IPROUTE2: Fix bug in display of ipv6 cloned/cached routes
@ 2007-07-11 18:37 Sridhar Samudrala
2007-07-11 18:46 ` Patrick McHardy
0 siblings, 1 reply; 4+ messages in thread
From: Sridhar Samudrala @ 2007-07-11 18:37 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
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.
Thanks
Sridhar
Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
diff --git a/ip/iproute.c b/ip/iproute.c
index 6fe4a70..08feceb 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -176,18 +176,19 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
if (filter.cloned) {
if (!(r->rtm_flags&RTM_F_CLONED))
return 0;
- }
- if (filter.tb) {
- if (r->rtm_flags&RTM_F_CLONED)
- return 0;
- if (filter.tb == RT_TABLE_LOCAL) {
- if (r->rtm_type != RTN_LOCAL)
+ } else {
+ if (filter.tb) {
+ if (r->rtm_flags&RTM_F_CLONED)
return 0;
- } else if (filter.tb == RT_TABLE_MAIN) {
- if (r->rtm_type == RTN_LOCAL)
+ if (filter.tb == RT_TABLE_LOCAL) {
+ if (r->rtm_type != RTN_LOCAL)
+ return 0;
+ } else if (filter.tb == RT_TABLE_MAIN) {
+ if (r->rtm_type == RTN_LOCAL)
+ return 0;
+ } else {
return 0;
- } else {
- return 0;
+ }
}
}
} else {
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] IPROUTE2: Fix bug in display of ipv6 cloned/cached routes
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
0 siblings, 1 reply; 4+ messages in thread
From: Patrick McHardy @ 2007-07-11 18:46 UTC (permalink / raw)
To: Sridhar Samudrala; +Cc: Stephen Hemminger, netdev
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?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] IPROUTE2: Fix bug in display of ipv6 cloned/cached routes
2007-07-11 18:46 ` Patrick McHardy
@ 2007-07-12 19:20 ` Sridhar Samudrala
2007-07-13 12:53 ` Patrick McHardy
0 siblings, 1 reply; 4+ messages in thread
From: Sridhar Samudrala @ 2007-07-12 19:20 UTC (permalink / raw)
To: Patrick McHardy; +Cc: Stephen Hemminger, netdev
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;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] IPROUTE2: Fix bug in display of ipv6 cloned/cached routes
2007-07-12 19:20 ` Sridhar Samudrala
@ 2007-07-13 12:53 ` Patrick McHardy
0 siblings, 0 replies; 4+ messages in thread
From: Patrick McHardy @ 2007-07-13 12:53 UTC (permalink / raw)
To: Sridhar Samudrala; +Cc: Stephen Hemminger, netdev
Sridhar Samudrala wrote:
> 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.
Your patch looks good, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-07-13 12:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2007-07-13 12:53 ` Patrick McHardy
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).