Can I use confstr to configure two nameservers?
I am trying to set up two dynamic nameserver IPs on my QNX system. I was able to use confstr to configure the address by setting the line _nameserver=xxx.xxx.xxx.xxx
to _CS_RESOLVE. Res_search then returns the correct IP address for the given name. I actually have two questions:
-
How do I set up two nameservers (primary and secondary) using setconf?
-
If the IP addresses of the nameserver change, can I just call setconf again to change them while my application is running?
According to the QNX docs , your confstr () parameter should contain:
nameserver_1.2.3.4
nameserver_5.6.7.8
(i.e. one line per nameserver with a maximum of three)
If the nameservers change, you probably need to call res_init()
to force the resolver library to use the new settings.