Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Jun 1998 15:42:22 +0200 (CEST)
From:      Andrzej Bialecki <abial@nask.pl>
To:        Jim Shankland <jas@flyingfox.com>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: Retrieving routing table via sysctl
Message-ID:  <Pine.NEB.3.95.980630154154.2425A-100000@korin.warman.org.pl>
In-Reply-To: <199806301327.GAA09844@biggusdiskus.flyingfox.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 30 Jun 1998, Jim Shankland wrote:

> Andrzej Bialecki <abial@nask.pl> writes:
> 
> > There are sysctl's which are named appropriately, but what they return
> > is a series of struct rt_msghdr, which doesn't contain the struct
> > sockaddr of the route itself and of the gateway... (I'm speaking here
> > about:
> > 
> > 	int mib[]={CTL_NET,PF_ROUTE,0,0,NET_RT_DUMP};
> > )
> > 
> > I'd like to be able to do this _without_ resorting to kread and friends,
> > so that it works on a stripped kernel.
> 
> The sockaddr's immediately follow the struct rt_msghdr; flags in the
> struct rt_msghdr tell you which sockaddr's are present.  Beware:  the
> sockaddr for a netmask is only 8 bytes long.  When in doubt, check
> against the kernel source, and/or carefully eyeball several sets of
> sample output.  This is not for the faint of heart, but it can be
> made to work.

Thanks to all who replied - I'll try this.

Andrzej Bialecki

--------------------+---------------------------------------------------------
abial@nask.pl       | if(halt_per_mth > 0) { fetch("http://www.freebsd.org") }
Research & Academic | "Be open-minded, but don't let your brains to fall out."
Network in Poland   | All of the above (and more) is just my personal opinion.
--------------------+---------------------------------------------------------


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.95.980630154154.2425A-100000>