HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: DNS API
Operating System - HP-UX
1834022
Members
2496
Online
110063
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2006 12:15 PM
01-31-2006 12:15 PM
DNS API
I want to bypass the nsswitch.conf and /etc/hosts setting and always get the DNS
reply for resolving a hostname (assuming
/etc/resolv.conf is there).
So I cannot use gethostbyname (which works
with the settings given in /etc/nsswitch.conf)
I tried to use the alternative that I thought
should be used i.e. res_init and res_query.
However it does not seem to work.
Any pointers ?
reply for resolving a hostname (assuming
/etc/resolv.conf is there).
So I cannot use gethostbyname (which works
with the settings given in /etc/nsswitch.conf)
I tried to use the alternative that I thought
should be used i.e. res_init and res_query.
However it does not seem to work.
Any pointers ?
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2006 01:14 PM
01-31-2006 01:14 PM
Re: DNS API
Using the config files for nameresolving is the proper way to set up your resolving.
Why would you try to circumvent this mechanism? If it doesn't work properly, just change the configuration and the respective files according to the way you want resolving to work.
Jan.
Why would you try to circumvent this mechanism? If it doesn't work properly, just change the configuration and the respective files according to the way you want resolving to work.
Jan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 12:49 PM
02-01-2006 12:49 PM
Re: DNS API
What do you mean by "it does not seem to work?" Do you not get replies, or do they come from places in nsswitch.conf?
You can use tusc to watch the system calls your application makes when it calls res_init and res_query and see if it opens say nsswitch.conf and/or resolv.conf
To be completely certain that you are sending the DNS query to the server of your choice, you should probably use res_mkquery and then sendto(), then poll() waiting for a reply which you would then recvfrom() and decode yourself.
While it _may_ be possible to go behind res_query's back and redirect it to servers other than those in the nsswitch.conf file, I doubt that such schennanigans would be supported. I do not remember if that ever worked very well with my netperf3 DNS_RR test (ftp.cup.hp.com/dist/networking/benchmarks/netperf/experimental/)
i think there were issues with threads and whether or not you could play with _res directly.
in netperf4 I've gone the res_mkquery etc path. my DNS reply decode requirements for netperf4 DNS query performance are somewhat minimal.
if want you really want is some sort of asynchronous DNS, I believe there are libraries out there for just that thing.
You can use tusc to watch the system calls your application makes when it calls res_init and res_query and see if it opens say nsswitch.conf and/or resolv.conf
To be completely certain that you are sending the DNS query to the server of your choice, you should probably use res_mkquery and then sendto(), then poll() waiting for a reply which you would then recvfrom() and decode yourself.
While it _may_ be possible to go behind res_query's back and redirect it to servers other than those in the nsswitch.conf file, I doubt that such schennanigans would be supported. I do not remember if that ever worked very well with my netperf3 DNS_RR test (ftp.cup.hp.com/dist/networking/benchmarks/netperf/experimental/)
i think there were issues with threads and whether or not you could play with _res directly.
in netperf4 I've gone the res_mkquery etc path. my DNS reply decode requirements for netperf4 DNS query performance are somewhat minimal.
if want you really want is some sort of asynchronous DNS, I believe there are libraries out there for just that thing.
there is no rest for the wicked yet the virtuous have no pillows
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP