diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2010-05-05 15:41:07 -0400 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2010-05-05 15:42:36 -0400 |
commit | 6299a310d77e6495efdf7c50491f0b055fee2cfe (patch) | |
tree | 636a10692ff37c4d7fb65f59d4be8a9c91724409 /utils/mountd | |
parent | 6ff1fd42db18c657fbc5f81169a566b41d53e731 (diff) | |
download | nfs-utils-6299a310d77e6495efdf7c50491f0b055fee2cfe.tar.gz nfs-utils-6299a310d77e6495efdf7c50491f0b055fee2cfe.tar.xz nfs-utils-6299a310d77e6495efdf7c50491f0b055fee2cfe.zip |
mountd/exportfs: Make m_addrlist field a nfs_sockaddr
To store non-AF_INET addresses in the nfs_client structure, we need to
use more than in_addr for the m_addrlist field. Make m_addrlist
larger, then add a few helper functions to handle type casting and
array indexing cleanly.
We could treat the nfs_client address list as if all the addresses
in the list were the same family. This might work for MCL_SUBNETWORK
type nfs_clients. However, during the transition to IPv6, most hosts
will have at least one IPv4 and one IPv6 address. For MCL_FQDN, I
think we need to have the ability to store addresses from both
families in one nfs_client.
Additionally, IPv6 scope IDs are not part of struct sin6_addr. To
support link-local IPv6 addresses and the like, a scope ID must be
stored.
Thus, each slot in the address list needs to be capable of storing an
entire socket address, and not simply the network address part.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/mountd')
-rw-r--r-- | utils/mountd/auth.c | 2 | ||||
-rw-r--r-- | utils/mountd/cache.c | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/utils/mountd/auth.c b/utils/mountd/auth.c index 13eba70..4b94b98 100644 --- a/utils/mountd/auth.c +++ b/utils/mountd/auth.c @@ -142,7 +142,7 @@ auth_authenticate_newcache(char *what, struct sockaddr_in *caller, return NULL; my_client.m_naddr = 1; - my_client.m_addrlist[0] = caller->sin_addr; + set_addrlist_in(&my_client, 0, caller); my_exp.m_client = &my_client; exp = NULL; diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index 6343325..caef5b2 100644 --- a/utils/mountd/cache.c +++ b/utils/mountd/cache.c @@ -863,6 +863,7 @@ int cache_export_ent(char *domain, struct exportent *exp, char *path) int cache_export(nfs_export *exp, char *path) { + struct sockaddr_in *sin = get_addrlist_in(exp->m_client, 0); int err; FILE *f; @@ -871,7 +872,7 @@ int cache_export(nfs_export *exp, char *path) return -1; qword_print(f, "nfsd"); - qword_print(f, inet_ntoa(exp->m_client->m_addrlist[0])); + qword_print(f, inet_ntoa(sin->sin_addr)); qword_printint(f, time(0)+30*60); qword_print(f, exp->m_client->m_hostname); err = qword_eol(f); |