[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Output of /sbin/route reversed?



On Thu, 13 Oct 2011 17:03:39 +0200, Wolfgang Karall wrote:

> On Thu, Oct 13, 2011 at 02:43:12PM +0000, Camaleón wrote:
>> On Thu, 13 Oct 2011 08:57:56 +0200, Wolfgang Karall wrote:
>> 
>> > I just noticed on my notebook running up-to-date sid that the output
>> > of route changed compared to what I've been used to for ages, in that
>> > it shows the default gateway as top-most line:
>> > 
>> > x61s:/etc# /sbin/route -n
>> > Kernel IP routing table
>> > Destination     Gateway         Genmask         Flags Metric Ref   
>> > Use Iface 0.0.0.0         10.135.15.254   0.0.0.0         UG    0    
>> >  0        0 eth0 [..rest of the about 15 entries get printed below..]
>> > 
>> > Is this something I missed regarding the kernel routing table? Or is
>> > this some problem with my setup? (plain ifupdown configuration plus
>> > OpenVPN, but it's the same w/out OpenVPN)
>> 
>> I also get the same on my wheezy (gateway displays first).
>> 
>> Curiously, "ip ro" is also affected and shows the default route in the
>> first row. Maybe an intended change from the net stack?
> 
> I didn't see anything in the NEWS when updating in the last couple of
> months and I only realized this recently, so I wonder where this change
> is documented.

Me neither... but "cat /proc/net/route" displays the data in the same 
(reversed) order.
 
> After all, this will break loads of custom scripts fetching the gateway
> address from the last line of the output of route.
> 
> Not that these scripts shouldn't be improved to at least search for
> ^0\.0\.0\.0 instead, which will still break since I suppose multiple
> default gateways get sorted in the "wrong" order now too...

Not sure how suitable/convenient could be relying on the order of the 
route command output. These things can break and "man route" says nothing 
about how to manipulate the output format (beyond the available flags) :-?

> Any idea where to ask how this change came to be, or which package to
> report a bug against?

It's part of the "net-tools" package. Maybe you can ask the maintainer 
about this.

Greetings,

-- 
Camaleón


Reply to: