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

  • From: Alexander Botero-Lowry <alex.boterolowry@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx, haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 02 Dec 2009 00:40:36 -0800

On Mon, 23 Nov 2009 10:41:35 +0100, "Axel =?utf-8?q?D=C3=B6rfler?=" 
<axeld@xxxxxxxxxxxxxxxx> wrote:
> Alexander Botero-Lowry <alex.boterolowry@xxxxxxxxx> wrote:
> > I'm planning to expand the interfaces configuration file; here is an
> > example:
> > 
> > interface /dev/net/ipro1000/0 {
> [...]
> >     # nameserver settings_template are in presedence order
> >     nameserver {
> 
> What would be the use of putting this under interface? You don't even 
> know the interface when someone asks to resolve an address.
> Beyond that, the routes already define which outgoing address goes to 
> which interface, so I don't see any need for doubling (and 
> complicating) that mechanism (in the end, the routes decide the 
> interface, anyway).
> 
I've split this into its own dns config file.

> > libbind would basically get the rudimentary code needed from 
> > net_server
> > settings.cpp (possibly made into a kit?) needed to parse this, and 
> > would
> 
> The driver settings API is in libroot.so.
> There is no need to translate the settings into BMessages for the client 
> side evaluation, I would guess.
> 
Indeed, I found the driver_settings api and have gotten my head around
it mostly. I've got a basic BApplication that responds to messages for
dns requests and sets up its basic enviornment based on parsing the
config file. So basically, everything I need for a basic DNS extension.
I'll look into making this into just a BLooper and merging it into
net_server in a bit. Still trying to get my head around C++ and the Be
APIs at the same time. :) So it was easier for me to do this stand-alone
at first.

> > 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.
> 
> In lcl_ho.c we iterate over the contents of 
> /boot/common/settings/network/hosts (there is no /etc/hosts anymore).
Yeah. I finally figured out how libbind basically sets itself
up. net_data_init gets called at some point, which calls irs_gen_acc,
which has the sideeffect of calling init_map_rules. init_map_rules goes
and, if there is no /etc/irs.conf, loads a default set of rules for
which services should be used for resolving different name types and in
what order. Thank you git grep :)

So my plan is to add an irs_haiku setup and haiku_ho implementation
which will send a request along to the netserver asking it to resolve
the host, if this fails it will fallback on the next choice in the rule
set (irs_dns, irs_lcl).

The nice part of this is that since in my dns looper i'm using the
resolver apis directly, I don't have to worry about the fun infinite
loop this could potentially cause. :)

Now that I actually kind of understand how libbind is doing stuff I'm
going to start plugging the new configuration stuff into it.

Alex

Other related posts: