Merging resolv.conf

12 Aug 2005 • 2 min read

baselayout-1.12.0_pre6 will now feature resolv.conf merging - basically taking the best information from active interfaces that we or dhcp has setup and merging it into one. For example

eth0 has

nameserver nameserver domain foo

eth1 has

nameserver nameserver search wibble wobble

This turns into a merged resolv.conf of

nameserver nameserver nameserver search foo wibble wobble

However, if eth1 has a lower metric than eth0 (eth0 wireless, eth1 wired for example) then it becomes

nameserver nameserver nameserver search wibble wobble foo

Duplicates are also removed 😃 Incase you're wondering why not all the information was taken across, well the answer is due to libc limitations. If you consult the resolv.conf man page then you'll discover that you're limited to 3 nameservers and 6 search domains. Great!

It's a trivial excercise to change the numbers we limit too, but they'll have no effect with current libc. But if anyone uses a libc/resolver with greater limits I'm happy to accept patches 😛

As it took a lot less time todo than I first thought, I'll merge ntp.conf information too - hopefully in time for pre6 8) EDIT: ntp.conf merging took 10 minutes and it is in 😄

If anyone used the resolvconf package which Debian uses, then this does a similar thing but transparently and without the need for a daemon.

Fans of the baselayout-1.12.0_pre releases so far will be pleased to know that we now default RC_AUTO_INTERFACE to no 😉