Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Mar 2009 17:41:11 -0400 (EDT)
From:      Rick Macklem <rmacklem@uoguelph.ca>
To:        freebsd-arch@freebsd.org
Subject:   getting a callback ip address for nfsv4 client
Message-ID:  <Pine.GSO.4.63.0903301733120.17182@muncher.cs.uoguelph.ca>

next in thread | raw e-mail | index | archive | help
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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.63.0903301733120.17182>