netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ip route show shows the routes in the inverse order?
@ 2012-03-13  1:18 Diego Woitasen
  2012-03-13  2:32 ` Stephen Hemminger
  0 siblings, 1 reply; 9+ messages in thread
From: Diego Woitasen @ 2012-03-13  1:18 UTC (permalink / raw)
  To: netdev

Hi,
 I've noticed that iproute and the old route command show the routes
in the inverse order. This new behavior looks related to the removal
of fib_hash (replaceed by fib_trie). I think that the old behavior
should be recovered. More specific routes in the first place looks
more natural for me and it's been the behavior for years. It doesn't
make any sense to change it.

 Sorry if this was already discussed, I couldn't find anything in the archives.

Regards,
 Diego

-- 
Diego Woitasen

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ip route show shows the routes in the inverse order?
  2012-03-13  1:18 ip route show shows the routes in the inverse order? Diego Woitasen
@ 2012-03-13  2:32 ` Stephen Hemminger
  2012-03-13  6:15   ` Bill Fink
  0 siblings, 1 reply; 9+ messages in thread
From: Stephen Hemminger @ 2012-03-13  2:32 UTC (permalink / raw)
  To: Diego Woitasen; +Cc: netdev

On Mon, 12 Mar 2012 22:18:48 -0300
Diego Woitasen <diego@woitasen.com.ar> wrote:

> Hi,
>  I've noticed that iproute and the old route command show the routes
> in the inverse order. This new behavior looks related to the removal
> of fib_hash (replaceed by fib_trie). I think that the old behavior
> should be recovered. More specific routes in the first place looks
> more natural for me and it's been the behavior for years. It doesn't
> make any sense to change it.
> 
>  Sorry if this was already discussed, I couldn't find anything in the archives.
> 
> Regards,
>  Diego
> 

The kerne never guaranteed any order in returned values. If you want a given
order than you need to sort them your self.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ip route show shows the routes in the inverse order?
  2012-03-13  2:32 ` Stephen Hemminger
@ 2012-03-13  6:15   ` Bill Fink
  2012-03-13  6:52     ` David Miller
  0 siblings, 1 reply; 9+ messages in thread
From: Bill Fink @ 2012-03-13  6:15 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Diego Woitasen, netdev

On Mon, 12 Mar 2012, Stephen Hemminger wrote:

> On Mon, 12 Mar 2012 22:18:48 -0300
> Diego Woitasen <diego@woitasen.com.ar> wrote:
> 
> > Hi,
> >  I've noticed that iproute and the old route command show the routes
> > in the inverse order. This new behavior looks related to the removal
> > of fib_hash (replaceed by fib_trie). I think that the old behavior
> > should be recovered. More specific routes in the first place looks
> > more natural for me and it's been the behavior for years. It doesn't
> > make any sense to change it.
> > 
> >  Sorry if this was already discussed, I couldn't find anything in the archives.
> > 
> > Regards,
> >  Diego
> > 
> 
> The kerne never guaranteed any order in returned values. If you want a given
> order than you need to sort them your self.

I understand the kernel doesn't guarantee any order to the routes.
But it does make sense for the userspace tools like ip to do this
for the user since the kernel is no longer doing this.  And having
more specific routes first also makes sense.  Some scripts may depend
on this plus its much more efficent that way if trying to find a
matching route since you can quit on the first match instead of
having to scan the entire routing table.

						-Bill

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ip route show shows the routes in the inverse order?
  2012-03-13  6:15   ` Bill Fink
@ 2012-03-13  6:52     ` David Miller
  2012-03-13 14:26       ` Diego Woitasen
  2012-03-13 15:37       ` Ben Greear
  0 siblings, 2 replies; 9+ messages in thread
From: David Miller @ 2012-03-13  6:52 UTC (permalink / raw)
  To: billfink; +Cc: shemminger, diego, netdev

From: Bill Fink <billfink@mindspring.com>
Date: Tue, 13 Mar 2012 02:15:29 -0400

> Some scripts may depend on this plus its much more efficent that way
> if trying to find a matching route since you can quit on the first
> match instead of having to scan the entire routing table.

No script should be doing stuff like this, let the tool do it for you
via "ip route get ADDR"

There is absolutely no argument for routes to be listed in one order
or another, and anything depending upon order is extremely fragile
and needs to be fixed up anyways.

If you're trying to match something, do a real lookup, a longest
prefix match lookup.  It's the only thing that's going to be correct
all the time, no matter what.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ip route show shows the routes in the inverse order?
  2012-03-13  6:52     ` David Miller
@ 2012-03-13 14:26       ` Diego Woitasen
  2012-03-13 16:47         ` Eric Dumazet
  2012-03-13 15:37       ` Ben Greear
  1 sibling, 1 reply; 9+ messages in thread
From: Diego Woitasen @ 2012-03-13 14:26 UTC (permalink / raw)
  To: David Miller; +Cc: billfink, shemminger, netdev

On Tue, Mar 13, 2012 at 3:52 AM, David Miller <davem@davemloft.net> wrote:
> From: Bill Fink <billfink@mindspring.com>
> Date: Tue, 13 Mar 2012 02:15:29 -0400
>
>> Some scripts may depend on this plus its much more efficent that way
>> if trying to find a matching route since you can quit on the first
>> match instead of having to scan the entire routing table.
>
> No script should be doing stuff like this, let the tool do it for you
> via "ip route get ADDR"
>
> There is absolutely no argument for routes to be listed in one order
> or another, and anything depending upon order is extremely fragile
> and needs to be fixed up anyways.

I don't aggree at this point. First, it was the behavior for years,
like a "de facto" standard. Second, there a "natural ordering"  for
routes. More specific match first, so it makes sense for them to be in
the first place.

>
> If you're trying to match something, do a real lookup, a longest
> prefix match lookup.  It's the only thing that's going to be correct
> all the time, no matter what.



-- 
Diego Woitasen

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ip route show shows the routes in the inverse order?
  2012-03-13  6:52     ` David Miller
  2012-03-13 14:26       ` Diego Woitasen
@ 2012-03-13 15:37       ` Ben Greear
  2012-03-14  5:30         ` Bill Fink
  1 sibling, 1 reply; 9+ messages in thread
From: Ben Greear @ 2012-03-13 15:37 UTC (permalink / raw)
  To: David Miller; +Cc: billfink, shemminger, diego, netdev

On 03/12/2012 11:52 PM, David Miller wrote:
> From: Bill Fink<billfink@mindspring.com>
> Date: Tue, 13 Mar 2012 02:15:29 -0400
>
>> Some scripts may depend on this plus its much more efficent that way
>> if trying to find a matching route since you can quit on the first
>> match instead of having to scan the entire routing table.
>
> No script should be doing stuff like this, let the tool do it for you
> via "ip route get ADDR"
>
> There is absolutely no argument for routes to be listed in one order
> or another, and anything depending upon order is extremely fragile
> and needs to be fixed up anyways.

The argument is ease of use by whatever human is reading the
information..but it could be done in the 'ip' tool.

Humans are fragile indeed, but it's often easier to fix the
computer than fix the humans.

Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ip route show shows the routes in the inverse order?
  2012-03-13 14:26       ` Diego Woitasen
@ 2012-03-13 16:47         ` Eric Dumazet
  0 siblings, 0 replies; 9+ messages in thread
From: Eric Dumazet @ 2012-03-13 16:47 UTC (permalink / raw)
  To: Diego Woitasen; +Cc: David Miller, billfink, shemminger, netdev

On Tue, 2012-03-13 at 11:26 -0300, Diego Woitasen wrote:

> I don't aggree at this point. First, it was the behavior for years,
> like a "de facto" standard. Second, there a "natural ordering"  for
> routes. More specific match first, so it makes sense for them to be in
> the first place.

Please provide an iproute2 patch, this is not a kernel issue at all.

Keep in mind it might be very tricky, since a machine can have tons of
routes.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ip route show shows the routes in the inverse order?
  2012-03-13 15:37       ` Ben Greear
@ 2012-03-14  5:30         ` Bill Fink
  2012-03-14  5:32           ` Stephen Hemminger
  0 siblings, 1 reply; 9+ messages in thread
From: Bill Fink @ 2012-03-14  5:30 UTC (permalink / raw)
  To: Ben Greear; +Cc: David Miller, shemminger, diego, netdev

On Tue, 13 Mar 2012, Ben Greear wrote:

> On 03/12/2012 11:52 PM, David Miller wrote:
> > From: Bill Fink<billfink@mindspring.com>
> > Date: Tue, 13 Mar 2012 02:15:29 -0400
> >
> >> Some scripts may depend on this plus its much more efficent that way
> >> if trying to find a matching route since you can quit on the first
> >> match instead of having to scan the entire routing table.
> >
> > No script should be doing stuff like this, let the tool do it for you
> > via "ip route get ADDR"
> >
> > There is absolutely no argument for routes to be listed in one order
> > or another, and anything depending upon order is extremely fragile
> > and needs to be fixed up anyways.
> 
> The argument is ease of use by whatever human is reading the
> information..but it could be done in the 'ip' tool.
> 
> Humans are fragile indeed, but it's often easier to fix the
> computer than fix the humans.

Speaking from experience, it's a royal point to look at unsorted
routes.  Perhaps it would be useful to add a sort option to the
"ip route show" command.

It makes more sense to fix a single user tool like "ip" than make
hundreds (or thousands) of admins work around the new behavior.

						-Bill

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ip route show shows the routes in the inverse order?
  2012-03-14  5:30         ` Bill Fink
@ 2012-03-14  5:32           ` Stephen Hemminger
  0 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2012-03-14  5:32 UTC (permalink / raw)
  To: Bill Fink; +Cc: Ben Greear, David Miller, diego, netdev

On Wed, 14 Mar 2012 01:30:21 -0400
Bill Fink <billfink@mindspring.com> wrote:

> On Tue, 13 Mar 2012, Ben Greear wrote:
> 
> > On 03/12/2012 11:52 PM, David Miller wrote:
> > > From: Bill Fink<billfink@mindspring.com>
> > > Date: Tue, 13 Mar 2012 02:15:29 -0400
> > >
> > >> Some scripts may depend on this plus its much more efficent that way
> > >> if trying to find a matching route since you can quit on the first
> > >> match instead of having to scan the entire routing table.
> > >
> > > No script should be doing stuff like this, let the tool do it for you
> > > via "ip route get ADDR"
> > >
> > > There is absolutely no argument for routes to be listed in one order
> > > or another, and anything depending upon order is extremely fragile
> > > and needs to be fixed up anyways.
> > 
> > The argument is ease of use by whatever human is reading the
> > information..but it could be done in the 'ip' tool.
> > 
> > Humans are fragile indeed, but it's often easier to fix the
> > computer than fix the humans.
> 
> Speaking from experience, it's a royal point to look at unsorted
> routes.  Perhaps it would be useful to add a sort option to the
> "ip route show" command.
> 
> It makes more sense to fix a single user tool like "ip" than make
> hundreds (or thousands) of admins work around the new behavior.
> 
> 						-Bill

patches accepted.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-03-14  5:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-13  1:18 ip route show shows the routes in the inverse order? Diego Woitasen
2012-03-13  2:32 ` Stephen Hemminger
2012-03-13  6:15   ` Bill Fink
2012-03-13  6:52     ` David Miller
2012-03-13 14:26       ` Diego Woitasen
2012-03-13 16:47         ` Eric Dumazet
2012-03-13 15:37       ` Ben Greear
2012-03-14  5:30         ` Bill Fink
2012-03-14  5:32           ` Stephen Hemminger

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).