From owner-freebsd-net@FreeBSD.ORG Tue Sep 16 18:39:39 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38E53106567D for ; Tue, 16 Sep 2008 18:39:39 +0000 (UTC) (envelope-from debarshi.ray@gmail.com) Received: from mail-gx0-f17.google.com (mail-gx0-f17.google.com [209.85.217.17]) by mx1.freebsd.org (Postfix) with ESMTP id E60958FC24 for ; Tue, 16 Sep 2008 18:39:38 +0000 (UTC) (envelope-from debarshi.ray@gmail.com) Received: by gxk10 with SMTP id 10so26083870gxk.19 for ; Tue, 16 Sep 2008 11:39:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=uadegF7zavoHPfpwVwKztz2Btg3n04Qu21j0oq9Xw9Y=; b=HVdQ6OkRabfol4kj02AxlCs9NNsX52zqrRv9TAHKCbiMB85K8LMuNIbB6IZE8sJ6cd tQ/dmkErAdtAMqMN0hdSvQpIc8OYM4yXUvBasMf+6e8B1/XGCn7vDsqV/VCLkhmARbWo jZdqehScbf6OGUFt44lD9tu4XoxCv7+kejzAE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:cc:in-reply-to :mime-version:content-type:content-transfer-encoding :content-disposition:references; b=QKLLfDUn8YonuI6NvzjgrxcxajFzi6D/rhV0WNSOs9cMkFqIcZBpIUo3g1R1wRYcLU aXCQrdXHALTPmYtxzBuaMUhL/6RX0eXYq2k0817DNZpYaX5FS4+kLp6vc+q7hiyHU+mo RjbUkbPPceTdoTHw1fXI7JU1eLdXMe/1d1BhA= Received: by 10.187.223.6 with SMTP id a6mr188090far.45.1221590377389; Tue, 16 Sep 2008 11:39:37 -0700 (PDT) Received: by 10.187.245.8 with HTTP; Tue, 16 Sep 2008 11:39:37 -0700 (PDT) Message-ID: <3170f42f0809161139k44b67895id412832aafe0568f@mail.gmail.com> Date: Wed, 17 Sep 2008 00:09:37 +0530 From: "Debarshi Ray" To: "Chris Inacio" In-Reply-To: <900019150809160829n7bf785ddn9ee2a86f11174885@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <900019150809160401v316682fdt4cf8a95bfcb48dc2@mail.gmail.com> <3170f42f0809160433x78d6637odc58da304cf3e19e@mail.gmail.com> <900019150809160829n7bf785ddn9ee2a86f11174885@mail.gmail.com> Cc: freebsd-net@freebsd.org Subject: Re: help with code to determine external IP address on FreeBSD gateway machine X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: debarshi.ray@gmail.com List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Sep 2008 18:39:39 -0000 Here is the code: http://rishi.fedorapeople.org/gnu/inetutils-1.5.tar.gz You will be interested in route/bsd_show.c and the function in that file named bsd_show. It uses a combination of sysctl and PF_ROUTE to retrieve the information. Please ask if you encounter any problem. :-) Happy hacking, Debarshi