diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2009-12-11 10:41:45 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2009-12-11 16:13:16 -0500 |
commit | 9889b48572e672f4535ca9dafd98d81146b7b834 (patch) | |
tree | f02040d933813a2198e7030c56ce92cd863c9852 /utils/mount/network.c | |
parent | bac279da80ae860267e8485d7fe2109096a326e9 (diff) | |
download | nfs-utils-9889b48572e672f4535ca9dafd98d81146b7b834.tar.gz nfs-utils-9889b48572e672f4535ca9dafd98d81146b7b834.tar.xz nfs-utils-9889b48572e672f4535ca9dafd98d81146b7b834.zip |
mount.nfs: make nfs_lookup() global
Expose a DNS query API that allows callers to request DNS results from
a specific address family.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/mount/network.c')
-rw-r--r-- | utils/mount/network.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/utils/mount/network.c b/utils/mount/network.c index ecb5acc..7d9accd 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -193,8 +193,18 @@ static const unsigned int *nfs_default_proto() } #endif /* MOUNT_CONFIG */ -static int nfs_lookup(const char *hostname, const sa_family_t family, - struct sockaddr *sap, socklen_t *salen) +/** + * nfs_lookup - resolve hostname to an IPv4 or IPv6 socket address + * @hostname: pointer to C string containing DNS hostname to resolve + * @family: address family hint + * @sap: pointer to buffer to fill with socket address + * @len: IN: size of buffer to fill; OUT: size of socket address + * + * Returns 1 and places a socket address at @sap if successful; + * otherwise zero. + */ +int nfs_lookup(const char *hostname, const sa_family_t family, + struct sockaddr *sap, socklen_t *salen) { struct addrinfo *gai_results; struct addrinfo gai_hint = { |