[erlang-questions] Inet config - don't monitor config files

Peti Gömöri gomoripeti@REDACTED
Fri Apr 3 15:55:18 CEST 2015


Hi all,

We are not using native DNS lookup but Erlang's own implementation. We
would like to read config files at startup but we don't want inet to
monitor them for changes.

I was happy to find in the documentation an example that does just
that for the hosts file (
http://www.erlang.org/doc/apps/erts/inet_cfg.html#id86806 )

%% -- ERLANG INET CONFIGURATION FILE --
      %% read the hosts file
      {file, hosts, "/etc/hosts"}.
      %% do not monitor the hosts file
      {hosts_file, ""}.

Great, this works fine so I tried the same for resolv.conf:

      %% read nameserver config from the resolv.conf file
      {file, resolv, "/etc/resolv.conf"}.
      %% do not monitor the resolv.conf file
      {resolv_conf, ""}.

Unfortunately this does not work for resolv.conf because inet_config
will remove all previous nameserver entries upon processing the
{resolv_conf, _} parameter and it always processes the {file, _, _}
parameters first (so reordering the config file does not help either).
Actually there is also problem if I don't specify any resolv_conf
option. Although the default resolv.conf won't be read at startup
(because of this commit
https://github.com/erlang/otp/commit/0377ecdfb001c4dc1b507ebc06211f29b19048e3)
but it will be at the first name lookup and it will remove previous
entries too.
See attached logs with empty and default resolv_conf settings respectively.

(Using R16B03-1 but there were hardly any changes on the relevant files since.)

So I don't see any way how {file, resolv, _} option could have any effect.
Is this intentional or a bug? How should the desired goal be achieved?

If this is a bug I would be happy to create a patch with some guidance
- should the empty string be special cased to not clear the previous config?


thanks
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: empty_resolv_conf.log
Type: application/octet-stream
Size: 774 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150403/8a8e1f8e/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: default_resolv_conf.log
Type: application/octet-stream
Size: 899 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150403/8a8e1f8e/attachment-0001.obj>


More information about the erlang-questions mailing list