diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2010-09-16 13:54:21 -0400 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2010-09-16 14:33:51 -0400 |
commit | 10a6b17d3588647ab5e1ee81ba40f1ce12a5184d (patch) | |
tree | 817d93605df04f443a545a70237973f906ce1fdf /utils/mountd/rmtab.c | |
parent | 76209cdbe989ee4cdfbf489f2695ac779457e763 (diff) | |
download | nfs-utils-10a6b17d3588647ab5e1ee81ba40f1ce12a5184d.tar.gz nfs-utils-10a6b17d3588647ab5e1ee81ba40f1ce12a5184d.tar.xz nfs-utils-10a6b17d3588647ab5e1ee81ba40f1ce12a5184d.zip |
mountd: Support IPv6 in mountlist_list()
Replace inet_aton(3) and gethostbyaddr(3) calls in mountlist_list()
with calls to the new host_foo() DNS helpers.
The new functions will support IPv6 without additional changes, once
IPv6 is enabled in the generic hostname helpers.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/mountd/rmtab.c')
-rw-r--r-- | utils/mountd/rmtab.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/utils/mountd/rmtab.c b/utils/mountd/rmtab.c index cd6abc8..d339296 100644 --- a/utils/mountd/rmtab.c +++ b/utils/mountd/rmtab.c @@ -194,8 +194,6 @@ mountlist_list(void) struct rmtabent *rep; struct stat stb; int lockid; - struct in_addr addr; - struct hostent *he; if ((lockid = xflock(_PATH_RMTABLCK, "r")) < 0) return NULL; @@ -220,11 +218,15 @@ mountlist_list(void) break; } - if (reverse_resolve && - inet_aton((const char *) rep->r_client, &addr) && - (he = gethostbyaddr(&addr, sizeof(addr), AF_INET))) - m->ml_hostname = strdup(he->h_name); - else + if (reverse_resolve) { + struct addrinfo *ai; + ai = host_pton(rep->r_client); + if (ai != NULL) { + m->ml_hostname = host_canonname(ai->ai_addr); + freeaddrinfo(ai); + } + } + if (m->ml_hostname == NULL) m->ml_hostname = strdup(rep->r_client); m->ml_directory = strdup(rep->r_path); |