Re: Calling rtalloc() from user program

"[.Greg Troxel <[email protected]>]"@ir.bbn.com
Newsgroups gmane.os.netbsd.help
Message-ID <[email protected]>
"Sourath Roy" <[email protected]> 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.
signature.asc (application/pgp-signature, 185 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (NetBSD)

iD8DBQFGA8oM+vesoDJhHiURArdOAJ4i6rE7U+ZWN/IffndYHYIBjro21QCeIzbD
wThMTunbCWqWf2a2rkypEUY=
=Bv0k
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.