From owner-freebsd-net@FreeBSD.ORG Mon Sep 1 12:39:11 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC1FF1065670 for ; Mon, 1 Sep 2008 12:39:11 +0000 (UTC) (envelope-from debarshi.ray@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.152]) by mx1.freebsd.org (Postfix) with ESMTP id 4E5708FC23 for ; Mon, 1 Sep 2008 12:39:11 +0000 (UTC) (envelope-from debarshi.ray@gmail.com) Received: by fg-out-1718.google.com with SMTP id l26so1228391fgb.35 for ; Mon, 01 Sep 2008 05:39:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :to:subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=CbAv1W02Ht0eI1Rr+AicUCQoXW6xyCg0Mn0RMRu3Ah0=; b=eOkcthOoMTD87gw8zrvx1Kqz8gtmHPEuiKheSzwTThQw4Hnj3blYULTDFCRdBMNpiw +p+cUxerwguyWiSJWvPiz06lVIc5NipTEKT1edg8Vo4e2ejNGLJ6eb2aj2q3yzIkIOUx hJd4rD7JXikrLNRgWT6Tuq5Gjt3nffsatCPgw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=eLLW5/qcQMvVuSHtj79dB4NDQ1NUoiab6FoyqEbuevHRLruyAyWBl0tnwlLGrw7x1G Gt7ZOUNR9Ia6NH1uWZ9RQyGxnxtPW368jh2uW5w1qNIsKahSF5nUGx20LVV0OGFiV8x3 XQQ4WeQdVIlGSK2EfzVSmxO4D4PB68zwII8Zc= Received: by 10.187.191.19 with SMTP id t19mr1926928fap.87.1220270827913; Mon, 01 Sep 2008 05:07:07 -0700 (PDT) Received: by 10.187.245.8 with HTTP; Mon, 1 Sep 2008 05:07:07 -0700 (PDT) Message-ID: <3170f42f0809010507q6c37a9d5q19649bc261d7656d@mail.gmail.com> Date: Mon, 1 Sep 2008 17:37:07 +0530 From: "Debarshi Ray" To: "FreeBSD networking and TCP/IP list" MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: reading routing table X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: debarshi.ray@gmail.com List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Sep 2008 12:39:11 -0000 I am implementing a library/utility which basically encompasses the features of the traditional route utilities and those of newer tools (like ip from iproute2), which are mostly specific to a particular kernel. The overpowering objective is to make the library/utility work uniformly across all different kernels, so that programs like NetworkManager have a portable library/utility to use instead of the Linux-kernel specific ip which is now being used. I was going through the FreeBSD and NetBSD documentation and the FreeBSD sources of netstat and route. I was suprised to see that while NetBSD's route implementation has a 'show' command, FreeBSD does not offer any such thing. Moreover it seems that one can not read the entire routing table using the PF_ROUTE sockets and RTM_GET returns information pertaining to only one destination. This suprised me because one can do such a thing with the Linux kernel's RTNETLINK. Is there a reason why this is so? Or is reading from /dev/kmem the only way to get a dump of the routing tables? Thanks, Debarshi