From owner-freebsd-arch@FreeBSD.ORG Mon Mar 30 21:35:19 2009 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BE441065821 for ; Mon, 30 Mar 2009 21:35:19 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from skerryvore.cs.uoguelph.ca (skerryvore.cs.uoguelph.ca [131.104.94.204]) by mx1.freebsd.org (Postfix) with ESMTP id 2C87A8FC1E for ; Mon, 30 Mar 2009 21:35:19 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from muncher.cs.uoguelph.ca (muncher.cs.uoguelph.ca [131.104.91.102]) by skerryvore.cs.uoguelph.ca (8.13.1/8.13.1) with ESMTP id n2ULZI5u031313 for ; Mon, 30 Mar 2009 17:35:18 -0400 Received: from localhost (rmacklem@localhost) by muncher.cs.uoguelph.ca (8.11.7p3+Sun/8.11.6) with ESMTP id n2ULfB718791 for ; Mon, 30 Mar 2009 17:41:11 -0400 (EDT) X-Authentication-Warning: muncher.cs.uoguelph.ca: rmacklem owned process doing -bs Date: Mon, 30 Mar 2009 17:41:11 -0400 (EDT) From: Rick Macklem X-X-Sender: rmacklem@muncher.cs.uoguelph.ca To: freebsd-arch@freebsd.org Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Scanned-By: MIMEDefang 2.63 on 131.104.94.204 Subject: getting a callback ip address for nfsv4 client X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Mar 2009 21:35:23 -0000 Well, since the last one turned out to be too easy, here's one I think is a little tougher... The nfsv4 client needs to know an ip address for the machine, that can be used by servers to do callbacks on the client. I currently use the following, which I know isn't correct, but usually works ok: loopb = htonl(INADDR_LOOPBACK); TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) { if (IA_SIN(ia)->sin_addr.s_addr != loopb) return (&(IA_SIN(ia)->sin_addr.s_addr)); } return (NULL); Now, I could just make it a constant set by an rc script (argument to the callback daemon or a sysctl variable), but that's a bother for laptops using dhcp and similar. I think allowing an argument to the callback daemon is a good fallback, but it would be nice if it didn't normally have to be set for things to work ok. Any ideas on how to do this? Thanks in advance for any help, rick ps: Part of the reason that the above loop doesn't seem to be good enough is that it requires "options VIMAGE_GLOBALS" to build.