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 | |
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>
-rw-r--r-- | utils/mount/network.c | 14 | ||||
-rw-r--r-- | utils/mount/network.h | 2 |
2 files changed, 14 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 = { diff --git a/utils/mount/network.h b/utils/mount/network.h index 7eb89b0..2cdf02e 100644 --- a/utils/mount/network.h +++ b/utils/mount/network.h @@ -45,6 +45,8 @@ int nfs_probe_bothports(const struct sockaddr *, const socklen_t, const socklen_t, struct pmap *); int nfs_gethostbyname(const char *, struct sockaddr_in *); int nfs_name_to_address(const char *, struct sockaddr *, socklen_t *); +int nfs_lookup(const char *hostname, const sa_family_t family, + struct sockaddr *sap, socklen_t *salen); int nfs_string_to_sockaddr(const char *, struct sockaddr *, socklen_t *); int nfs_present_sockaddr(const struct sockaddr *, const socklen_t, char *, const size_t); |