From owner-freebsd-arch@FreeBSD.ORG Sun Apr 12 11:58:30 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 51F76106564A; Sun, 12 Apr 2009 11:58:30 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from itchy.rabson.org (router.rabson.org [80.177.232.241]) by mx1.freebsd.org (Postfix) with ESMTP id 04C5F8FC1B; Sun, 12 Apr 2009 11:58:29 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from [IPv6:2001:470:909f:1:21b:63ff:feb8:5abc] (unknown [IPv6:2001:470:909f:1:21b:63ff:feb8:5abc]) by itchy.rabson.org (Postfix) with ESMTP id 8DB675C39; Sun, 12 Apr 2009 12:42:48 +0100 (BST) Message-Id: From: Doug Rabson To: Rick Macklem In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Date: Sun, 12 Apr 2009 12:42:24 +0100 References: <49D98461.4000002@elischer.org> X-Mailer: Apple Mail (2.930.3) Cc: Robert Watson , Julian Elischer , freebsd-arch@FreeBSD.org Subject: Re: 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: Sun, 12 Apr 2009 11:58:30 -0000 On 6 Apr 2009, at 16:56, Rick Macklem wrote: > > > On Mon, 6 Apr 2009, Robert Watson wrote: > >> On Sun, 5 Apr 2009, Julian Elischer wrote: >> >>>> One possibility is to connect() a socket to the server address, >>>> then call getsockaddr() to query what address the network stack >>>> is using. If the connection completed, then the address could at >>>> least send packets to the server, even if it isn't reachable from >>>> the server. >>>> (Obviously, kernel versions of the above...) >>> we ended up with him doing "whatever the connect code would have >>> done" since as he is in fact inside the kernel, he can just do the >>> same.. >> >> I figured that if the RPC layer was going to make a connection >> anyway, we could just query the RPC layer and ask it what address >> it had used. However, if the decision needs to be made earlier >> than that, then that doesn't make as much sense. This would mean >> NFS could avoid knowing about routes and interfaces, and just know >> about sockets and addresses. >> > > I just took a quick look at Doug's RPC code and the socket doesn't > seem to be exposed to the client side by the rpc layer, so I think > that rtalloc1() is probably easier? I'd also be worried about > knowing when the socket > pointer is valid and in a connected state. (The rtalloc1() code only > uses the > one path rt->rt_ifa->ifa_addr after sanity checking that the > pointers aren't null, so I don't think it will be difficult to > maintain. It does imply > that the code knows the route locking rules, but that just means it > uses RTFREE_LOCKED(rt), so as long as that macro keeps working, it > should > be ok, I think.) While the RPC code doesn't currently expose the socket or local address, I don't think there would be many problems in adding a client control operation to get the local address. Its not a good idea to allow access to the actual socket since that will change over reconnects. In theory, the local address may also change over reconnects but that seems less likely to be a problem. Also, the reconnect machinery doesn't actually create the connection until the first RPC so some care would be needed to account for that.