Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jul 2011 00:10:59 -0700
From:      Garrett Cooper <yanegomi@gmail.com>
To:        "Alexander V. Chernikov" <melifaro@ipfw.ru>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: [PATCH] Remove dead code in netstat from route.c
Message-ID:  <CAGH67wQDZ31Qc1Yd=wOBByPSSkj01MdEZa4dVBAP8wxe6s9o0g@mail.gmail.com>
In-Reply-To: <4E1BE6D8.60805@ipfw.ru>
References:  <CAGH67wS1EQFkmCKiv-VPrJFc_JXV5oTjfmht-anqbmpibJkMfQ@mail.gmail.com> <4E1BE6D8.60805@ipfw.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 11, 2011 at 11:16 PM, Alexander V. Chernikov
<melifaro@ipfw.ru> wrote:
> Garrett Cooper wrote:
>> Hi,
>> =A0 =A0 While trying to determine how to print out routes via kvm for
>> net-snmp, I noticed that there's a chunk of code from the 4.4 BSD Lite
>> days that isn't executed in netstat as NewTree is always 0. The
>> following patch removes that dead code and gets the FreeBSD source for
>> netstat more in line with NetBSD and OpenBSD's copy.
>> Thanks!
>
> Hello!
>
> This code is still working (I've tested it several months ago). Using
> RT_DUMP sysctl gives us less information than KVM, but this is much more
> =A0better way of requesting infromation:
> KVM heavily assumes RADIX rtee is used and simply implement walking the
> tree in userland (p_tree()) which is quite hackish. Since some dynamic
> routing software can change massive amounts of data at once (BGP session
> with full-view going up/down) or physical interface with several hundred
> vlans goes up/down - requesting routing data via KVM can lead to fully
> unexpected behaviour. Calling this on regular basis on net-snmp is not
> the best thing one can do.
>
> Additionally, there can be address families where RADIX is unnecessary
> complicated since only direct key match is required (MPLS, for example).
> Moving from RADIX implementation for such family will require a lot of
> 'if (af =3D=3D AF_MPLS)' code in many base userland utilities since
> assumption that RADIX is used do exists in many places, unfortunately.
>
> Requesting routes via KVM is completely undocumented and kernel
> internals dependent way. From the other side, NET_RT_DUMP sysctl is
> documented in sysctl(3) and is used by all major routing software
> (quagga, bird,openbgp). It also brings us more RADIX-dependent which
> should be avoided.

    That's a compelling argument, but why is NewTree hardwired to 0
then (apart from the fact that kvm works with non-live kernel images)?
Thanks,
-Garrett



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGH67wQDZ31Qc1Yd=wOBByPSSkj01MdEZa4dVBAP8wxe6s9o0g>