Subject: Re: Calling rtalloc() from user program
To: Sourath Roy <sourath@gmail.com>
From: "[.Greg Troxel <gdt@ir.bbn.com>
List: netbsd-help
Date: 03/23/2007 08:37:32
--=-=-=


"Sourath Roy" <sourath@gmail.com> writes:

> Hi All,
> I am using NetBSD 3.0.1 and I was trying to call function rtalloc/rtfree

(This belongs on netbsd-help, not current-users.)

> from my program to retrieve route information for a destination address.
> Currently I am unable to link the program, it doesn't find rtalloc() and
> rtfree().
> (throws error: undefined reference to `rtalloc')
> I tried searching over the internet whether they are a part of any shared
> library and I need to point to that during the link.
> But so far I couldn't find something worth noting.

These are kernel functions, not userspace, so you simply cannot call
them from user programs.

> Can these functions be accessed from user programs? If yes, then
> please let me know how.

Probably you want to use the routing socket to ask the kernel about
the route.

See route(4), and in particular RTM_GET.

Also see route(8), and the get operation.
For example, do

  route get -n www.netbsd.org

The route(8) sources in src/sbin/route are likely a helpful example of
how to use the routing socket with RTM_GET.

--=-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (NetBSD)

iD8DBQFGA8oM+vesoDJhHiURArdOAJ4i6rE7U+ZWN/IffndYHYIBjro21QCeIzbD
wThMTunbCWqWf2a2rkypEUY=
=Bv0k
-----END PGP SIGNATURE-----
--=-=-=--