Date: Mon, 07 Feb 2000 21:27:04 +0000 From: Brian Somers <brian@Awfulhak.org> To: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> Cc: "gbnaidu " <gbnaidu@my-Deja.com>, freebsd-net@freebsd.org, brian@hak.lan.Awfulhak.org Subject: Re: How to get outgoing interface... Message-ID: <200002072127.VAA03499@hak.lan.Awfulhak.org> In-Reply-To: Message from Garrett Wollman <wollman@khavrinen.lcs.mit.edu> of "Mon, 07 Feb 2000 11:42:26 EST." <200002071642.LAA27059@khavrinen.lcs.mit.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
> <<On Sun, 06 Feb 2000 21:17:21 -0800, "gbnaidu " <gbnaidu@my-Deja.com> said:
>
> [Paragraph reformatted for legibility. In the future, please press
> return at the end of each 72-character line.]
>
> > I am trying to dump the routing table using the sysctl system
> > call. I am able to get the destination address, gateway, mask all
> > these entries. But How do I get the outgoing interface for a
> > particular entry in the routing table?
>
> Keep on looking in the routing message. A typical response will look
> like this:
>
> sockaddrs: <DST,GATEWAY,NETMASK,IFP,IFA>
> default anacreon default fxp0:0.a0.c9.3c.76.5c khavrinen
>
> You have found the first three sockaddrs in the message; the RTA_IFP
> sockaddr will tell you which interface is being used, and the RTA_IFA
> one will tell you the IP address configured on that interface.
FWIW an example can be found in src/usr.sbin/ppp/route.c - clearer
(but less functional) than the ifconfig sources IMHO.
> -GAWollman
>
> --
> Garrett A. Wollman | O Siem / We are all family / O Siem / We're all the same
> wollman@lcs.mit.edu | O Siem / The fires of freedom
> Opinions not those of| Dance in the burning flame
> MIT, LCS, CRS, or NSA| - Susan Aglukark and Chad Irschick
--
Brian <brian@Awfulhak.org> <brian@FreeBSD.org>
<http://www.Awfulhak.org> <brian@OpenBSD.org>
Don't _EVER_ lose your sense of humour ! <brian@FreeBSD.org.uk>
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200002072127.VAA03499>
