From owner-freebsd-net Mon Feb 7 13:37: 4 2000 Delivered-To: freebsd-net@freebsd.org Received: from awfulhak.org (dynamic-56.max4-du-ws.dialnetwork.pavilion.co.uk [212.74.9.184]) by builder.freebsd.org (Postfix) with ESMTP id 20DAB3E1F for ; Mon, 7 Feb 2000 13:36:59 -0800 (PST) Received: from hak.lan.Awfulhak.org (root@hak.lan.Awfulhak.org [172.16.0.12]) by awfulhak.org (8.9.3/8.9.3) with ESMTP id VAA04813; Mon, 7 Feb 2000 21:26:59 GMT (envelope-from brian@hak.lan.Awfulhak.org) Received: from hak.lan.Awfulhak.org (brian@localhost.lan.Awfulhak.org [127.0.0.1]) by hak.lan.Awfulhak.org (8.9.3/8.9.3) with ESMTP id VAA03499; Mon, 7 Feb 2000 21:27:04 GMT (envelope-from brian@hak.lan.Awfulhak.org) Message-Id: <200002072127.VAA03499@hak.lan.Awfulhak.org> X-Mailer: exmh version 2.1.1 10/15/1999 To: Garrett Wollman Cc: "gbnaidu " , freebsd-net@freebsd.org, brian@hak.lan.Awfulhak.org Subject: Re: How to get outgoing interface... In-Reply-To: Message from Garrett Wollman of "Mon, 07 Feb 2000 11:42:26 EST." <200002071642.LAA27059@khavrinen.lcs.mit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 07 Feb 2000 21:27:04 +0000 From: Brian Somers Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > < 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: > 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 Don't _EVER_ lose your sense of humour ! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message