NetBSD Problem Report #52197

From www@NetBSD.org  Thu Apr 27 16:02:57 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id AD2EE7A1C0
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 27 Apr 2017 16:02:57 +0000 (UTC)
Message-Id: <20170427160256.999897A2AF@mollari.NetBSD.org>
Date: Thu, 27 Apr 2017 16:02:56 +0000 (UTC)
From: bruce.lilly@gmail.com
Reply-To: bruce.lilly@gmail.com
To: gnats-bugs@NetBSD.org
Subject: route show [-inet6] truncates and/or misaligns ipv6 numeric addresses
X-Send-Pr-Version: www-1.0

>Number:         52197
>Category:       bin
>Synopsis:       route show [-inet6] truncates and/or misaligns ipv6 numeric addresses
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 27 16:05:00 +0000 2017
>Originator:     Bruce Lilly
>Release:        7.0 STABLE (earliest tested) through 7.1 (latest tested)
>Organization:
>Environment:
$ uname -ors
NetBSD 7.0_STABLE NetBSD

# uname -ors
NetBSD 7.1 NetBSD
>Description:
route show (w/o -n) sometimes outputs unresolved numeric addresses; these are truncated in the output, with misleading semantics, e.g. (numeric addresses obfuscated for privacy):

# route show -inet6 | sed -e 's/[0-9a-f][0-9a-f][0-9a-f][0-9a-f]:/XXXX:/g' -e 's/:[0-9a-f][0-9a-f][0-9a-f][0-9a-f]/:XXXX/g' -e 's/[0-9a-f][0-9a-f]:/XX:/g' -e 's/:[0-9a-f][0-9a-f]/:XX/g'                
Routing tables

Internet6:
Destination        Gateway            Flags    Refs      Use    Mtu Interface
default            XXXX:XXXX:XXXX:0:a UG          -        -      -  bge0
localhost          localhost          UH          -        -  33648  lo0
XXXX:XXXX:XXXX::/6 link#1             U           -        -      -  bge0
XXXX:XXXX:XXXX:0:7 XX:XX:XX:XX:XX:XX  UHL         -        -      -  lo0
XXXX:XXXX:XXXX:0:a XX:XX:XX:XX:XX:XX  UHL         -        -      -  bge0
XXXX::%bge0/64     link#1             U           -        -      -  bge0
XXXX::XXXX:XXXX:XX XX:XX:XX:XX:XX:XX  UHL         -        -      -  lo0
XXXX::XXXX:XXXX:XX XX:XX:XX:XX:XX:XX  UHL         -        -      -  bge0
XXXX::%lo0/64      XXXX::1            U           -        -      -  lo0
XXXX:1::/32        link#1             U           -        -      -  bge0
XXXX:3::/32        localhost          U           -        -      -  lo0
XXXX::%bge0/32     link#1             U           -        -      -  bge0
XXXX::XX           link#1             UHL         -        -      -  bge0
XXXX::%lo0/32      localhost          U           -        -      -  lo0

In the above output, the first numeric destination is shown as a /6 block when it is in fact a /64 block, which is quite a different thing.

With -n, route (via rtutil.c) widens the fields for inet6, but the fields are then misaligned because (1) the spacing of the headings does not match the data field widths and (2) the field widths do not match the data widths. E.g.:

# route -n show -inet6 | sed -e 's/[0-9a-f][0-9a-f][0-9a-f][0-9a-f]:/XXXX:/g' -e 's/:[0-9a-f][0-9a-f][0-9a-f][0-9a-f]/:XXXX/g' -e 's/[0-9a-f][0-9a-f]:/XX:/g' -e 's/:[0-9a-f][0-9a-f]/:XX/g'             
Routing tables

Internet6:
Destination                        Gateway                        Flags    Refs      Use    Mtu Interface
default                            XXXX:XXXX:XXXX:0:XXXX:XXXX:XXXX:XXXX UG          -        -      -  bge0
::1                                ::1                            UH          -        -  33648  lo0
XXXX:XXXX:XXXX::/64                link#1                         U           -        -      -  bge0
XXXX:XXXX:XXXX:0:XXXX:XXXX:XXXX:XXXX XX:XX:XX:XX:XX:XX              UHL         -        -      -  lo0
XXXX:XXXX:XXXX:0:XXXX:XXXX:XXXX:XXXX XX:XX:XX:XX:XX:XX              UHL         -        -      -  bge0
XXXX::%bge0/64                     link#1                         U           -        -      -  bge0
XXXX::XXXX:XXXX:XXXX:XXXX          XX:XX:XX:XX:XX:XX              UHL         -        -      -  lo0
XXXX::XXXX:XXXX:XXXX:XXXX          XX:XX:XX:XX:XX:XX              UHL         -        -      -  bge0
XXXX::%lo0/64                      XXXX::1                        U           -        -      -  lo0
XXXX:1::/32                        link#1                         U           -        -      -  bge0
XXXX:3::/32                        ::1                            U           -        -      -  lo0
XXXX::%bge0/32                     link#1                         U           -        -      -  bge0
XXXX::XX                           link#1                         UHL         -        -      -  bge0
XXXX::%lo0/32                      ::1                            U           -        -      -  lo0

Note that some destination addresses extend into the Gateway field, some gateway addresses extend into the Flags field; Flags and later fields do not line up.
>How-To-Repeat:
See examples in the Full description.
>Fix:
No fix at this time, but it looks like most of the issues are in /usr/src/sbin/route/rtutil.c.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.