[haiku-development] Re: Proposal: {dns,name,resolver}_server

  • From: Alexander Botero-Lowry <alex.boterolowry@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx, haiku-development@xxxxxxxxxxxxx, Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • Date: Sun, 22 Nov 2009 01:17:29 -0800

On Thu, 12 Nov 2009 08:50:12 -0800, Alexander Botero-Lowry 
<alex.boterolowry@xxxxxxxxx> wrote:

> > > Still think the fallback isn't worth the trouble/complexity though. 
> > > :) Basically means
> > > we end up implementing DNS twice and not necessairly identically.
> > 
> > That's would indeed be the wrong way: libbind should be the only real 
> > DNS resolver - it should be used by the net_server to do the real work, 
> > and by the clients as a fallback mechanism. The net_server only extends 
> > the capabilities, and provides caching. Things like Bonjour would end 
> > up in the net_server, while smaller extensions could well be 
> > implemented as part of libnetwork.so.
> > 
> Ok that makes sense. libbind will be augmented to read the new config and 
> support
> primary/secondary dns from that, while the dns extension in net_server will 
> use
> libbind to do more advanced resolution and caching.
> 
So I finally got virtualbox setup on my new laptop and started hacking.

I've got a basic handle on how to manipulate res_state and make queries
with libbind with whatever nameserver i want, and so I started poking at 
the configuration aspect of it:

I'm planning to expand the interfaces configuration file; here is an
example:

interface /dev/net/ipro1000/0 {
    address {
        family  inet
        auto_config
    }

    # nameserver settings_template are in presedence order
    nameserver {
        address {
             family     inet
             address 10.0.0.1
        } # reuse the address settings_template
        domain ".example.com"
        # domain means this will only be used to match *.example.com
        # I'm going back and forth on whether this should allow multiple
        # with space seperated values or with new domain settings.
        #
        # because this one has a domain, it's not considered the
        # ``primary'' nameserver
    }

    nameserver {
        address {
            family      inet
            address 192.168.2.1
        }
        search "z"
        # match anything, search under *.z if the initial attempt fails
        # to resolve, this is the first dns server in the interfaces
        # file without restrictions so it's the primary

        bogus-nxdomain {
            address {
                family  inet
                address 12.34.56.78
            }
        }
        # treat ips that resolve by this nameserver to 12.34.56.78 as nxdomain
    }

    # basically /etc/hosts, but supports . wildcarding
    host {
        match ".z"
        # matches *.z
        match "localhost"
        match "localhost.localdomain"
        # here using new match clauses instead of space seperated, still unclear
        address {
            family inet
            address 127.0.0.1
        }
    }
}

libbind would basically get the rudimentary code needed from net_server
settings.cpp (possibly made into a kit?) needed to parse this, and would
basically take all the unencumbered (no domain clause) put their search
clauses in res_state.dnsrch, and their ns addresses into
res_state.nsaddr_list. I haven't looked into how /etc/hosts works
internally in libbind yet, but presumebly something similar would be
done for non-wildcard host settings templates.

alex

Other related posts: