summaryrefslogtreecommitdiffstats
path: root/utils/mountd
Commit message (Collapse)AuthorAgeFilesLines
* mountd: Honor the no_root_squash flag on pseudo rootsJ. Bruce Fields2012-05-291-1/+4
| | | | | | | | | | | | From: "J. Bruce Fields" <bfields@redhat.com> If root squashing is turned off on a export that has multiple directories, the parent directories of the pseudo exports that's built, also needs to have root squashing turned off. Tested-by: Steve Dickson <steved@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: handle allocation failures in auth_unix_ip upcallJ. Bruce Fields2012-05-031-3/+9
| | | | | | | From: "J. Bruce Fields" <bfields@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: prepend '$' to make use_ipaddr clients self-describingJ. Bruce Fields2012-05-033-7/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From: "J. Bruce Fields" <bfields@redhat.com> Mountd is responsible for filling three interrelated kernel caches: - auth_unix_ip maps an incoming ip addresses to a "domain". - nfsd_fh maps (domain, filehandle-fragment) pairs to paths. - nfsd_export maps (domain, path) pairs to export options. Note that each export is assocated with a "client" string--the part before the parentheses in an /etc/export line--which may be a domain name, a netgroup, etc. The "domain" string in the above three caches may be either: - in the !use_ipaddr case, a comma-separated list of client strings. - in the use_ipaddr case, an ip address. In the former case, mountd does the hard work of matching an ip address to the clients when doing the auth_unix_ip mapping. In the latter case, it delays that until the nfsd_fh or nfsd_export upcall. We're currently depending on being able to flush the kernel caches completely when switching between the use_ipaddr and !use_ipaddr cases. However, the kernel's cache-flushing doesn't really provide reliable guarantees on return; it's still possible we could see nfsd_fh or nfsd_export upcalls with the old domain-type after flushing. So, instead, make the two domain types self-describing by prepending a "$" in the use_ipaddr case. Reviewed-by: NeilBrown <neilb@suse.de> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: add trivial helpers for client-matchingJ. Bruce Fields2012-05-033-13/+24
| | | | | | | | | | | From: "J. Bruce Fields" <bfields@redhat.com> Pull out a tiny bit of common logic from three functions. Possibly minor overkill, but simplifies the next patch. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: parse ip address earlierJ. Bruce Fields2012-05-031-18/+22
| | | | | | | | | | | | | | I don't see the point of waiting to the last minute to parse the ip address. If the client name isn't a legal ip address then this will fail fairly quickly, so there's not much of a performance penalty. Also, note the previous code incorrectly assumed client_resolve would always return non-NULL. Also factor out some common code. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: fix export upcall failure in use_ipaddr caseJ. Bruce Fields2012-05-031-0/+1
| | | | | | | | | | | | | After 0509d3428f523 "mountd: Replace "struct hostent" with "struct addinfo"", the export upcall fails in the use_ipaddr case. I think we never noticed because a) the use_ipaddr case is rarer than the !use_ipaddr case, and b) the nfsd_fh upcall does a preemptive export downcall that renders the nfsd export call unnecessary in some cases. Cc: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* v4_root_add_parents: remove a possible buffer overflow.NeilBrown2012-05-011-2/+2
| | | | | | | | | | | | | | | | | | | | | The loop in v4root_add_parents() is a little odd. The first time through, 'ptr' points immediately "beyond" a '/' character (the first). For every other iterration it points directly "at" a '/' character. Such inconsistency is error prone and infact there is an error. If "path" is precisely "/", then the first call to ptr = strchr(ptr, '/') will be given a 'ptr' which is beyond the '\0' at the end of "path". This could potentially contain anything and the strchr() could search well beyond a buffer (though this depends on exactly how the string is set up which depends on separate code). So change the loop to have 'ptr' always point at a '/', and handle the special case of "/" explicitly. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* v4root: set the time-to-live for V4ROOT exports to the DEFAULT.NeilBrown2012-05-011-0/+1
| | | | | | | | | | | | | | e_ttl is set to the default in init_exportent(). However V4ROOT exports never see init_exportent() as they are created with dupexportent from a template. So e_ttl does not get set and export entries expire immediately. This results in an upcall to mountd every time a V4ROOT directory in accessed. So set e_ttl in the template. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* 4set_root: force "fsid=0" for all exports of '/'NeilBrown2012-05-011-0/+7
| | | | | | | | | | | | | | | When "fsid=0" is not explicitly given in /etc/exports, v4set_root creates a pseudo (NFSEXP_V4ROOT) export for '/' with fsid 0 so that an NFSv4 client can find the root. However if '/' is explicitly exported to the client, then that explicit export must be used, and it will not have fsid=0. So we must impose fsid=0 on all exports of '/'. Without this, if '/' is exported to a client, that client will not be able to mount '/' with NFSv4. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsd_fh: if two exports are possible, choose the one without V4ROOTNeilBrown2012-05-011-1/+10
| | | | | | | | | | | | | | | | | | | | | When nfsd_fh it looking for an export for a particular client and file-handle, it might find two exports for the same path: one with NFSEXP_V4ROOT, one with out. As nfsd_fh calls cache_export_ent to give the export information to the kernel it much choose the same export that auth_authenticate chooses for get_rootfh which it also passes cache_export_ent (via cache_export). i.e. it must choose the non-V4ROOT on where possible. Also change strcmp(foo, bar) to strcmp(foo, bar) == 0 because I have a pathological fear of the former. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* auth_authenticate_newcache: prefer non-V4ROOT export over V4ROOT exportsNeilBrown2012-05-011-4/+3
| | | | | | | | | | | | | Currently auth_authenticate_internal finds an export and if it is a V4ROOT export, it reports that there is no match. Unlike lookup_export() it doesn't keep looking for an acceptable export. So remove the test from auth_authenticate_internal(), and add it to auth_authenticate_newcache(), where the search can be allowed to continue. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* lookup_export: really prefer nonV4ROOT exports.NeilBrown2012-05-011-3/+7
| | | | | | | | | | | | lookup_export() claims to "Always prefer non-V4ROOT mounts" (meaning "exports") but actually prefers V4ROOT exports - once it has 'found' one it will never replace it. So fix that inversion, and add code so that it proactively prefers a non-V4ROOT whether it is found before or after a V4ROOT. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: support IPv6 [] escaping with fsloc hostsWeston Andros Adamson2012-05-011-3/+17
| | | | | | | | | | | | | mountd uses colons to split fsloc hosts, but this doesn't work with IPv6 addresses (they contain ':'). To fix this, mountd is changed to expect all IPv6 addresses to be escaped by '[' and ']' so colons that are part of the address may be skipped. To fix IPv6 referrals, this patch must be used with the nfsd patch that properly parses escaped IPv6 addresses in fs_location->hosts. Signed-off-by: Weston Andros Adamson <dros@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* autoconf: only link binaries that need it to libtirpcJeff Layton2012-01-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is essentially the same as the previous version, but has been respun to fix up some merge conflicts with some of Chuck's recent changes. When we first added tirpc support, we took a "big hammer" approach, and had it add libtirpc to $LIBS. That had the effect of making it so that that library was linked into every binary. That's unnecessary, and wasteful with memory. Don't let AC_CHECK_LIB add -ltirpc to $LIBS. Instead, have the autoconf tests set $(LIBTIRPC) in the makefiles, and have the programs that need it explicitly include that library. In the event that we're not using libtirpc, then set $LIBTIRPC to a blank string. This necessitates a change to the bindresvport_sa check too. Since that library is no longer included in $LIBS, we need to convert that check to use AC_CHECK_LIB instead of AC_CHECK_FUNCS. This patch also fixes a subtle bug. If the library was usable, but the includes were not, the test would set $enable_tirpc to "no", but HAVE_LIBTIRPC would still be true. That configuration would likely fail to build. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Support junction management plug-insChuck Lever2012-01-052-2/+225
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To support FedFS and NFS junctions without introducing additional build-time or run-time dependencies on nfs-utils, the community has chosen to use a dynamically loadable library to handle junction resolution. There is one plug-in library for mountd that will handle any NFS- related junction type. Currently there are two types: o nfs-basic locally stored file set location data, and o nfs-fedfs file set location data stored on an LDAP server mountd's support for this library is enabled at build time by the presence of the junction API definition header: /usr/include/nfs-plugin.h If this header is not found on the build system, mountd will build without junction support, and will operate as before. Note that mountd does not cache junction resolution results. NFSD already caches these results in its exports cache. Thus each time NFSD calls up to mountd, it is, in essence, requesting a fresh junction resolution operation, not a cached response. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: remove newline from xlog() format specifier stringsChuck Lever2012-01-051-5/+5
| | | | | | | | Clean up: xlog() already adds a newline to the end of each line of output. Remove the superfluous newline from a number of xlog() call sites in mountd. Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Plug v4root memory leakChuck Lever2012-01-051-1/+1
| | | | | | | | | | | | Valgrind reports that the memory allocated for eep's e_hostname field was not being freed. eep is not visible outside of v4root_create(), so we don't need to strdup() that string. Introduced by commit 3b777b0 "exports: NFSv4 pseudoroot support routines" (Dec 1, 2009). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Fixed strcmp usage in in insert groups.Matthew Treinish2011-08-031-1/+1
| | | | | | | | | Fixed the usage of strcmp in the duplicate check in insert groups. Fixes an issue with showmount and other commands that required the group information. Signed-off-by: Matthew Treinish <treinish@linux.vnet.ibm.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.mountd: let mountd consult /etc/services for portMi Jinlong2011-08-031-1/+4
| | | | | | | | | | | | At RHEL, if user set port for mountd at /etc/services as "mount 12345/tcp", mountd should be bind to 12345, but the latest nfs-utils, mountd get a rand port, not 12345. This patch make sure mountd be bind to the port which was set at /etc/service. Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: move fsidtype-specific code to helpersJ. Bruce Fields2011-06-271-111/+129
| | | | | | | Now we can move these big switch statements into helper functions. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: gather fsid information into one structJ. Bruce Fields2011-06-271-34/+45
| | | | | | | | | | | | A large part of nfsd_fh() is concerned with extracting fsid-type-specific information from the fsid, then matching that information with information from the export list and the filesystem. Moving all that information into one struct will allow some further simplifications. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: prefer explicit subexports over crossmnt parentsJ. Bruce Fields2011-06-271-3/+15
| | | | | | | | | | | | | | If a parent is exported with crossmnt, and if a child is also explicitly exported, then both exports could potentially produce matches in this loop; that isn't a bug. Instead of warning and ignoring the second match we find, we should instead prefer whichever export is deeper in the tree, so that children's options can override those of their parents. Reported-by: Olga Kornievskaia <aglo@citi.umich.edu> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Fix missing varialble assignment in auth_unix_gidPavel Shilovsky2011-06-071-2/+4
| | | | | | | | | When we get into auth_unix_gid at the second time, groups_len is not 0 and ngroups variable leave as 0. Then we use ngroups in getgrouplist that fails in this case. This patch fixes it. Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Steve Dickson <steved@redhat.com>
* Removed compilation warnings from mountd/cache.cJim Rees2011-05-181-5/+5
| | | | | | | Commit 5604b35a6 introduced a number of missing initializer warnings that were missed. This patch removes those warnings. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Increase the stdio file buffer size for procfs filesSean Finney2011-04-191-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, when writing to /proc/net/rpc/*/channel, if a cache line were larger than the default buffer size (likely 1024 bytes), mountd and svcgssd would split writes into a number of buffer-sized writes. Each of these writes would get an EINVAL error back from the kernel procfs handle (it expects line-oriented input and does not account for multiple/split writes), and no cache update would occur. When such behavior occurs, NFS clients depending on mountd to finish the cache operation would block/hang, or receive EPERM, depending on the context of the operation. This is likely to happen if a user is a member of a large (~100-200) number of groups. Instead, every fopen() on the procfs files in question is followed by a call to setvbuf(), using a per-file dedicated buffer of RPC_CHAN_BUF_SIZE length. Really, mountd should not be using stdio-style buffered file operations on files in /proc to begin with. A better solution would be to use internally managed buffers and calls to write() instead of these stdio calls, but that would be a more extensive change; so this is proposed as a quick and not-so-dirty fix in the meantime. Signed-off-by: Sean Finney <sean.finney@sonyericsson.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Use a dynamic buffer for storing lists of gid'sSean Finney2011-04-191-9/+20
| | | | | | | | | | | | | Previously, in auth_unix_gid, group lists were stored in an array of hard-coded length 100, and in the situation that the group lists for a particular call were too large, the array was swapped with a dynamically allocated/freed buffer. For environments where users are commonly in a large number of groups, this isn't an ideal approach. Instead, use malloc/realloc to grow the list on an as-needed basis. Signed-off-by: Sean Finney <sean.finney@sonyericsson.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exports: add a configurable time-to-live for the kernel cache entriesChuck Lever2011-04-061-7/+8
| | | | | | | | | | | | | | | | | | | | | | From: Trond Myklebust <Trond.Myklebust@netapp.com> The fedfs ldap server will specify a ttl for its entries. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> This is a refactoring change only. There should be no change in behavior. Original patch had updates to utils/mountd/junctions.c, which no longer exists. These are not included here. Create a macro for the default cache TTL, which is used in several places besides the export cache. Make e_ttl unsigned. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Removed a warning from v4root.cSteve Dickson2011-04-061-3/+6
| | | | | | v4root.c:176:9: warning: variable 'ret' set but not used Signed-off-by: Steve Dickson <steved@redhat.com>
* Fixed segfault in rpc.mountdSteve Dickson2011-01-261-0/+1
| | | | | | | | | A unallocated piece of memory, instead of a NULL point, was being used to initialize a ->next point in the mount link list which caused a segfault after a few remote accesses via the showmount command. Signed-off-by: Steve Dickson <steved@redhat.com>
* Updated rpc.mountd man pageSteve Dickson2010-10-201-3/+3
| | | | | | | | Updated the rpc.mountd man page to no longer reference v3 as the "newer" version and also mentioned v4 as a supported version. Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Clear mountd registrations at start upChuck Lever2010-10-141-6/+4
| | | | | | | | Clear stale MNT registrations before mountd tries to create fresh listeners, to ensure that mountd starts. This is also what statd does. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Update mountd/exportfs man pages to reflect IPv6 changesChuck Lever2010-09-271-86/+154
| | | | | | | | | | | | Document IPv6 support in rpc.mountd and exportfs, and clarify existing language in the man page. Clean up: Use bold consistently for program names, and italics consistently for file names. Use "rpc.mountd" consistently as the name of the mountd daemon. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Use MNT status values instead of NFSERRChuck Lever2010-09-271-11/+11
| | | | | | | | | Clean up: The MNT protocol has its own enum type defining error status values. While the values can be the same as the NFSERR enum type on some systems, it's not guaranteed to be true everywhere. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Fix up version and usage messagesChuck Lever2010-09-271-16/+22
| | | | | | | | | Clean up: rpc.mountd is no longer known as kmountd. Use the program's basename rather than the full pathname for the usage message. Display a version message at start up similar to statd's. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Unregister mountd if my_svc_run() returnsChuck Lever2010-09-271-1/+2
| | | | | | | | | | | Fix a long standing bug: when my_svc_run() returns, mountd should unregister itself with the local rpcbind so that it can subsequently start cleanly. Log a more helpful error message in this case. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Support TI-RPC mountd listenerChuck Lever2010-09-271-9/+17
| | | | | | | | | | | If TI-RPC is available, use it to create mountd's svc listener. If not, use the old function, rpc_init(), to create mountd's listener. IPv6 can be supported if TI-RPC is available. In this case, /etc/netconfig is searched to determine which transports to advertise. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Make NFS version checks more strictChuck Lever2010-09-271-8/+39
| | | | | | | | Ensure users and programmers specify NFS version numbers correctly. This also makes the next patch more clean. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Ensure cache downcall can handle IPv6 addressesChuck Lever2010-09-161-1/+1
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Handle IPv6 addresses in kernel auth_unix_ip upcallsChuck Lever2010-09-161-3/+3
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: clean up cache APIChuck Lever2010-09-163-14/+43
| | | | | | | | | | | | | | | | | | | | | | | Clean up: Squelch compiler warnings and document public parts of cache API. cache.c: At top level: cache.c:67: warning: no previous prototype for auth_unix_ip cache.c:123: warning: no previous prototype for auth_unix_gid cache.c:217: warning: no previous prototype for get_uuid cache.c:247: warning: no previous prototype for uuid_by_path cache.c:326: warning: no previous prototype for nfsd_fh cache.c:745: warning: no previous prototype for nfsd_export cache.c:820: warning: no previous prototype for cache_open cache.c:832: warning: no previous prototype for cache_set_fd cache.c:841: warning: no previous prototype for cache_process_req cache.c:921: warning: no previous prototype for cache_export cache.c:953: warning: no previous prototype for cache_get_filehandle Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Support IPv6 in mountlist_list()Chuck Lever2010-09-161-7/+9
| | | | | | | | | | | 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>
* mountd: Handle memory exhaustion in mountlist_list()Chuck Lever2010-09-161-8/+24
| | | | | | | | | | | | I'm about to replace inet_aton(3)/gethostbyaddr(3) with host_pton()/host_canonname() in mountlist_list(). Since host_canonname() returns a string allocated with strdup(3) instead of xstrdup(), mountlist_list() must now deal with memory exhaustion properly. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Add mountlist_freeall()Chuck Lever2010-09-161-6/+13
| | | | | | | | I'm about to add a second bit of logic that needs to free all mountlist records, so introduce a helper for freeing them. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: support IPv6 in mountlist_del_all()Chuck Lever2010-09-163-9/+7
| | | | | | | | Replace IPv4-specific code in the mountlist_del_all() path with code that is address family agnostic. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Support IPv6 in mountd's svc routinesChuck Lever2010-09-161-20/+59
| | | | | | | | | | | | | | Replace IPv4-specific code with use of our generic hostname helpers in the routines that handle incoming MNT RPC requests. These functions will support IPv6 without additional changes, once IPv6 is enabled in the generic hostname helpers. As part of this update, I've modified all of mountd's _svc routines to use a debug message format that is consistent with statd. It may be overkill for some of these; if so we can pull them out later. Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: add IPv6 support in auth_authenticate()Chuck Lever2010-09-164-35/+39
| | | | | | | Make the entire auth_authenticate() code path address-family agnostic. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libnfs.a: Fix API for getfh() & friendsChuck Lever2010-09-161-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Removed warnings from mountd.cSteve Dickson2010-08-091-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mountd.c: In function 'mount_null_1_svc': mountd.c:195: warning: unused parameter 'rqstp' mountd.c:195: warning: unused parameter 'argp' mountd.c:195: warning: unused parameter 'resp' mountd.c: In function 'mount_dump_1_svc': mountd.c:213: warning: unused parameter 'argp' mountd.c: In function 'mount_umnt_1_svc': mountd.c:224: warning: unused parameter 'resp' mountd.c: In function 'mount_umntall_1_svc': mountd.c:248: warning: unused parameter 'argp' mountd.c:248: warning: unused parameter 'resp' mountd.c: In function 'mount_export_1_svc': mountd.c:258: warning: unused parameter 'argp' mountd.c: In function 'mount_exportall_1_svc': mountd.c:269: warning: unused parameter 'argp' mountd.c: In function 'mount_dump_1_svc': mountd.c:216: warning: unused parameter 'argp' mountd.c: In function 'mount_umnt_1_svc': mountd.c:227: warning: unused parameter 'resp' mountd.c: In function 'mount_umntall_1_svc': mountd.c:251: warning: unused parameter 'argp' mountd.c:251: warning: unused parameter 'resp' mountd.c: In function 'mount_export_1_svc': mountd.c:261: warning: unused parameter 'argp' mountd.c: In function 'mount_exportall_1_svc': mountd.c:272: warning: unused parameter 'argp' Signed-off-by: Steve Dickson <steved@redhat.com>
* Removed warnings from cache.cSteve Dickson2010-08-091-9/+9
| | | | | | | | | | | | | | | | | | cache.c:812: warning: missing initializer cache.c:812: warning: (near initialization for 'cachelist[0].f') cache.c:813: warning: missing initializer cache.c:813: warning: (near initialization for 'cachelist[1].f') cache.c:814: warning: missing initializer cache.c:814: warning: (near initialization for 'cachelist[2].f') cache.c:815: warning: missing initializer cache.c:815: warning: (near initialization for 'cachelist[3].f') cache.c:816: warning: missing initializer cache.c:816: warning: (near initialization for 'cachelist[4].f') cache.c: In function 'cache_export_ent': cache.c:887: warning: comparison between signed and unsigned integer expressions cache.c:907: warning: comparison between signed and unsigned integer expressions Signed-off-by: Steve Dickson <steved@redhat.com>
* Removed warnings from fsloc.cSteve Dickson2010-08-093-3/+3
| | | | | | | fsloc.c: In function 'replicas_lookup': fsloc.c:149: warning: unused parameter 'key' Signed-off-by: Steve Dickson <steved@redhat.com>