Retrieve nameserver \ dns info when rabbit configured for dhcp

I posted this on the BB shortly before it was replaced with this forum so I thought it would be worth re-posting.

I’m writing an app that mimics window’s tcp\ip settings in that the user can select dhcp or configure their own static network settings. I want to display the network settings and I have easily figured out how to grab the IP, netmask, and gateway using the ifconfig() function. I can not for the life of me figure out how to get the dns
ameserver setting. Any ideas?

You can only set the nameserver using ifconfig, there is currently no way to get the nameserver using ifconfig that I know of. Use IFS_NAMESERVER_SET or IFS_NAMESERVER_ADD to set or add nameservers using ifconfig and IFS_NAMESERVER_DEL to delete them.

Take a look at the servlist functions in servlist.lib, thats what net.lib uses internally. servlist_first and servlist_next can be used to get the nameservers. Here’s some examples that might start you in the right direction…

longword nameserver;
nameserver = servlist_first(&_dns_server_table, 0, NULL);
nameserver = servlist_first(&_dns_server_table, DNS_PREDEFINED, NULL);

The second parameter, source, can be one of DNS_PREDEFINED, DNS_PPP, DNS_DHCP, or DNS_ALL_SOURCES, or zero for “most preferred” (based on looking at dns.lib).


Sorry for hijacking this thread, but it is the only one that had a question and an answer on this topic.

I don’t know all the networking terminology, so I hope you understand my question in layman terms.

I need to give my Rabbit a friendly name (much like you would give a PC on a network and name), and set it up for DHCP. Then using our DNS and DHCP servers on the network, I want to be able to have access to the Rabbit using its name, rather than its IP address. At present, I don’t know how to assign a name to the Rabbit. Does anyone have a clue?