On Tue, Aug 29, 2006 at 02:02:22PM +0200, Oliver Fromme wrote: > Julian Elischer wrote: > > I need some processes to look elsewhere for DNS information from where > > the rest > > of the system looks.. This patch seems to me a simple solution. > > We over-ride where the resolver looks for resolv.conf using an > > environment variable. > > This would allow me to reset this to an application specific config file > > that > > specifies a different server. > > I think that could be useful indeed. In fact it could have > been very helpful to me recently when I had to debug a very > strange resolver problem (it turned out that the DSL modem > dropped SOA and ANY requests). > > In theory, there would be a different (and maybe better) > solution to the problem. On the "FreeBSD Ideas" web page > there is an entry to port variant symlinks from DragonFly > (but as far as I know, nobody is actually working on it). > Using variant symlinks, the problem could easily be solved: > > $ ls -l /etc/resolv* > -r--r--r-- 1 root wheel ... /etc/resolv.conf -> resolv-${RES}.conf > -r--r--r-- 1 root wheel ... /etc/resolv-default.conf > -r--r--r-- 1 root wheel ... /etc/resolv-special.conf > $ varsym RES > RES=default > $ cat /etc/resolv.conf > nameserver 11.22.33.44 > $ varsym RES=special > $ cat /etc/resolv.conf > nameserver 55.66.77.88 > > It also has the advantage that the admin still has some > control over it, because the symlink can only point to > existing files under /etc in this case. By the way, the > varsym variables can be set globally, per-user and per- > process. > > However, I'm aware that variant symlinks are probably not > going to be available in FreeBSD anytime soon. Therefore > I think your patch to libc/net/res_init.c would be useful.
Actually there's a patch floating around. I don't remember what the most recent status is, but it does work and I've got it in the branch I run on my laptop. There's some diagreement about the order of evaluation of the various tables with the patch implementing a pid overrides user which overrides global and rwatson arguing for the opposite (which is what AFS does). I think I'd like to see the AFS version plus a "default" table since I find Robert's arguments compelling, but have applications where a default is needed. Alternativly ${varname-default_value} syntax could be implemented alongside AFS semantics. -- Brooks P.S. The motivating application in my case is making /tmp a varsym which points to storage with the ordinary semantics for ordinary processes, but is overriden to point to a managed directory for processes within a batch job under Sun Grid Engine.
pgpKlH50kZq2D.pgp
Description: PGP signature