From owner-freebsd-net Fri Oct 4 9:28: 9 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E14D937B401 for ; Fri, 4 Oct 2002 09:28:06 -0700 (PDT) Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5190A43E65 for ; Fri, 4 Oct 2002 09:27:59 -0700 (PDT) (envelope-from ru@whale.sunbay.crimea.ua) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.6/8.11.2) id g94GQvN00949; Fri, 4 Oct 2002 19:26:57 +0300 (EEST) (envelope-from ru) Date: Fri, 4 Oct 2002 19:26:57 +0300 From: Ruslan Ermilov To: yatin chalke Cc: freebsd-net@FreeBSD.ORG Subject: Re: Parsing route dump received using sysctl Message-ID: <20021004162657.GB91159@sunbay.com> References: <20021004160850.25674.qmail@web9501.mail.yahoo.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="tjCHc7DPkfUGtrlw" Content-Disposition: inline In-Reply-To: <20021004160850.25674.qmail@web9501.mail.yahoo.com> User-Agent: Mutt/1.3.99i Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --tjCHc7DPkfUGtrlw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 04, 2002 at 09:08:50AM -0700, yatin chalke wrote: > Hi, >=20 > I am currently trying to get a route dump in > freebsd4.4 using sysctl with NET_RT_DUMP. >=20 > I am running into problems while parsing the returned > rt_msghdr structures. >=20 > The sockaddr structures returned after the rt_msghdr > are messed up and it is not giving correct gateway or > netmask. >=20 > For ex: when I am parsing the received route dump the > netmask received is nonzero(random value) for a > default route (which it returns as 0.0.0.0) and also > netmask doesnt appear to be a sockaddr structure. >=20 > Also for further routes gateway and netmasks are > 0.0.0.0. > I am parsing the received sockaddr structures to get > all the values depending on flag bits set in rt_msghdr > structure. >=20 > If anyone can help me in this matter it will be a > great help. >=20 Look at the route(8) code, you're probably missing the necessary alignments (with the ROUNDUP() macro). Cheers, --=20 Ruslan Ermilov Sysadmin and DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age --tjCHc7DPkfUGtrlw Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD) iD8DBQE9ncFRUkv4P6juNwoRAgnVAJ9kNPjMibQbduU01bjYKC8nUnL+hgCfbOes yaI3HgpbSwZyT5sJ0itXwnM= =Nby+ -----END PGP SIGNATURE----- --tjCHc7DPkfUGtrlw-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message