Expose a DNS query API that allows callers to request DNS results from a specific address family. Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx> --- utils/mount/network.c | 14 ++++++++++++-- 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); -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html