summaryrefslogtreecommitdiffstats
path: root/utils/mountd/mountd.h
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2010-09-16 09:32:52 -0400
committerSteve Dickson <steved@redhat.com>2010-09-16 14:33:51 -0400
commit29b8a7700129d9768e3e2d94c81eec9f84ba8691 (patch)
tree4245a37bc9abc6b313a7c489e17c32e2c7b785bc /utils/mountd/mountd.h
parenta88c279992f4b63e3dcaac9930e300fd4bb03dd7 (diff)
downloadnfs-utils-29b8a7700129d9768e3e2d94c81eec9f84ba8691.tar.gz
nfs-utils-29b8a7700129d9768e3e2d94c81eec9f84ba8691.tar.xz
nfs-utils-29b8a7700129d9768e3e2d94c81eec9f84ba8691.zip
libnfs.a: Fix API for getfh() & friends
This is more of a clean-up than a behavioral change. POSIX requires that a "struct sockaddr" is the same size as a "struct sockaddr_in". Therefore, a variable or field of type "struct sockaddr" cannot contain an AF_INET6 address. However, "struct sockaddr *" is often used to reference a generic (ie non-address family specific) socket address, generating some confusion about this. The nfsctl_arg struct uses a struct sockaddr (not a pointer) to pass the client's IP address to the kernel. This means the legacy nfsctl() kernel API can never support IPv6. Fortunately for us, this legacy interface was replaced by a text-based cache interface a few years back. We don't need to support non-AF_INET addresses here. The getfh() functions in nfs-utils provide a handy C API for the kernel's nfsctl interface. The getfh() functions still take a struct sockaddr *, though, and that can imply that a non-IPv4 address can be passed via this API. To make it abundantly clear that only IPv4 addresses can be used with this interface, change the synopses of getfh() and friends to take a struct sockaddr_in * instead of a struct sockaddr * . This makes these functions conform with other places in mountd and exportfs that already grok the difference between a struct sockaddr and a struct sockaddr_in. While we're here... Introduce some nice documenting comments for the get_fh() functions, and... Since mountd will support IPv6 in the near future, assert that the family of client addresses passed to this API is indeed AF_INET, in order to prevent non-AF_INET addresses from ever being passed to the legacy nfsctl() interface. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/mountd/mountd.h')
0 files changed, 0 insertions, 0 deletions