From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 12 07:11:00 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D55681065670 for ; Tue, 12 Jul 2011 07:11:00 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 8AD148FC16 for ; Tue, 12 Jul 2011 07:11:00 +0000 (UTC) Received: by vws18 with SMTP id 18so4477241vws.13 for ; Tue, 12 Jul 2011 00:10:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=+HY9Njx/gJcpOHrzHbTg7mFwU8rA77iuac7kZLdLaXY=; b=FGzM4taniV/IV9aHyugNQ6y7xZP5gg+9YF1f82NKZRiYp/MHA3oY2wPcFZORgM8AlE U8ic6eGEqI9l55dwpsdGYSborUjVaKbcIivc/2ag15EUVtgGbrnuEYzFfT1yCh7798iN bhIu5x/OgBamRB0DXIcaO4Y+B01ZNo+uoIvtg= MIME-Version: 1.0 Received: by 10.221.1.11 with SMTP id no11mr1086400vcb.246.1310454659569; Tue, 12 Jul 2011 00:10:59 -0700 (PDT) Received: by 10.220.72.75 with HTTP; Tue, 12 Jul 2011 00:10:59 -0700 (PDT) In-Reply-To: <4E1BE6D8.60805@ipfw.ru> References: <4E1BE6D8.60805@ipfw.ru> Date: Tue, 12 Jul 2011 00:10:59 -0700 Message-ID: From: Garrett Cooper To: "Alexander V. Chernikov" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: [PATCH] Remove dead code in netstat from route.c X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2011 07:11:00 -0000 On Mon, Jul 11, 2011 at 11:16 PM, Alexander V. Chernikov 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