Mailinglist Archive: opensuse (958 mails)

< Previous Next >
Re: [opensuse] Paths of DNS Queries
On 01/05/2019 14.15, Anton Aylward wrote:
On 2019-05-01 7:47 a.m., Carlos E. R. wrote:
On 01/05/2019 13.22, Anton Aylward wrote:

Perhaps I didn't make myself clear.
When an application such as Firefox make a library call "gethostbyname()"
(or is that obsolete now?) what happens?

I may be wrong but I think the first thing that happens is that there is a
look-see to /etc/nsswitch.conf to see what should be invoked.
Mine says:
hosts: files dns
which, I take it, means check /etc/hosts first and then use the configired
DNS
resolver if the address isn't found in the hosts file.

Two things occur to me at this point.
The first is that dnsmasq slurps up /etc/hosts anyway so the 'files' entry
is
redundant.

Before that point (before reading from /etc/hosts) is the nscd intercept.

You mean that -- somehow, some unspecified manner -- that happens before the
decision as to whether to use files or DNS or something else as determined by
the nsswitch.conf file is accessed?

No, after the decision.

If the decision is files, it is nscd who answers what the files say.
If the decision is bind, it is nscd who answers what the bind says.

Or, maybe it intercepts, find out he doesn't know the answer, lets the
call to the library continue, and when there is an answer it stores the
answer in the cache for the next time.


As I said, I'm using dnsmasq and NOT nscd.

Did you notice that nscd also caches other services, and that you can
disable just dns?


The decision path still has to be there.

But it seems that nscd is not part of the design. It is an afterthought
by someone (maybe the same people, I do not know).


man:

«nscd provides caching for accesses of the passwd(5), group(5),
hosts(5) services(5) and netgroup databases through standard libc
interfaces, such as getpwnam(3), getpwuid(3), getgrnam(3), getgrgid(3),
gethostbyname(3), and others.»

I don't know if it intercepts the calls to those functions, or if it
replaces them in full. I don't know the exact mechanism.

The second is I don't see how things get to dnsmasq.
Can someone help me here, please.

Sorry Carlos, "Intercepted' is just too vague a concept.
Somehow, somewhere there is a decision-in-software, an 'if" statement based
on a
config file entry, and not a beady-eyed raptor waiting to swoop down on an
unsuspecting rodent.

nscd is not in the "official" loop, IMHO, so instead it puts itself in
the middle intercepting some library calls

HOW?
Right now you are talking the realm of magic and I don't accept it.
This is a computer. there HAS to be a deterministic, repeatable, identifiable,
documented mechanism that works for everyone, even those of us living in
mana-poor areas of the world.

So?


"Intercept" is too vague a concept.
There HAS to be a decision path arising from a configuration file setting.
This beady-eyed raptor waiting to whoop down and 'intercept' is too
asynchronous, to inconsistent and unreliable.

Didn't you study the interrupt intercept concept used in MsDOS? It is a
similar thing. ISR?

Only that I don't know how exactly it is done in Linux.

Suppose there is a table somewhere that says calls to "gethostbyname()
are done to this address". Suppose nscd replaces the address with his
own. Intercept.

Or something vaguely similar, I don't know the exact mechanism in Linux.


You sure can work with vague concepts and incomplete information, that's
a human feature.




and giving an answer without
the library reaching its designed goal of reading the hosts file or
querying a DNS.

I can not explain in detail because I do not know, I simply guess.

I too guess, but then I investigate and look for documentation.
If I can't find it I discard that guess and try antoehr one.

Well, I have read programming guides in Linux but this detail I have not
found.


I've found that dnsmasq wants to listen locally so there should be an entry in
the /etc/resolv.conf file of 127.0.0.1

Or not.

cat /etc/resolv.conf:

nameserver 192.168.1.16
nameserver 80.58.61.250
nameserver 80.58.61.254


192.168.1.16 is dnsmasq on another computer.

As far as your computer knows, it is simply asking a DN server on some
machine, that in your case happens to be the same one, and it happens
that the service is done by dnsmasq. There is no difference.

--
Cheers / Saludos,

Carlos E. R.

(from openSUSE, Leap 15.1 x86_64 (ssd-test))

--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
List Navigation
Follow Ups