summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* libexport.a: Add documenting commentsChuck Lever2010-06-222-9/+39
| | | | | | | | Clean up. Add a few additional documenting comments for globally visible functions. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Make export_add() staticChuck Lever2010-06-222-5/+2
| | | | | | | | Clean up: export_add() is not called from outside of export.c, so make it a static helper. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Make export_read() return voidChuck Lever2010-06-222-3/+7
| | | | | | | | Clean up: export_read()'s return value is always zero, and its only caller never checks it. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Replace "struct hostent" with "struct addrinfo"Chuck Lever2010-06-228-212/+257
| | | | | | | | | | | | | | | | | | | struct hostent can store either IPv4 or IPv6 addresses, but it can't store both address families concurrently for the same host. Neither can hostent deal with parts of socket addresses that are outside of the sin{,6}_addr field. Replace the use of "struct hostent" everywhere in libexport.a, mountd, and exportfs with "struct addrinfo". This is a large change, but there are so many strong dependencies on struct hostent that this can't easily be broken into smaller pieces. One benefit of this change is that hostent_dup() is no longer required, since the results of getaddrinfo(3) are already dynamically allocated. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: Add a common exit label in exportfs()Chuck Lever2010-06-221-8/+6
| | | | | | | | | Clean up: Reduce code duplication by introducing a goto label for freeing hp and exiting. This will make replacing "struct hostent *" with "struct addrinfo *" more straightforward in this code. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Add helpers to manage DNS lookupsChuck Lever2010-06-226-16/+382
| | | | | | | | | | | | | | | Introduce DNS query helpers based on getaddrinfo(3) and getnameinfo(3). These will eventually replace the existing hostent-based functions in support/export/hostname.c. Put some of these new helpers to immediate use, where convenient. As they are part of libexport.a, I've added the forward declarations for these new functions in exportfs.h rather than misc.h, where the hostent-based forward declarations are currently. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Improve support for exporting btrfs subvolumesNeilBrown2010-06-221-29/+78
| | | | | | | | | | | | | | | | | | | If you export two subvolumes of a btrfs filesystem, they will both be given the same uuid so lookups will be confused. blkid cannot differentiate the two, so we must use the fsid from statfs64 to identify the filesystem. We cannot tell if blkid or statfs is best without knowing internal details of the filesystem in question, so we need to encode specific knowledge of btrfs in mountd. This is unfortunate. To ensure smooth handling of this and possible future changes in uuid generation, we add infrastructure for multiple different uuids to be recognised on old filehandles, but only the preferred on is used on new filehandles. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: silently fails when the network protocol is not foundSteve Dickson2010-06-222-8/+27
| | | | | | | mount.nfs should display some type of error diagnostics when the network protocol can not be determined. Signed-off-by: Steve Dickson <steved@redhat.com>
* mount: silently fails when bad option values are givenSteve Dickson2010-06-222-5/+19
| | | | | | | | mount.nfs should not only fail when an invalid option values are supplied (as it does), it should also print a diagnostic message identifying the problem Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsiostat.man: Add linebreak before --version optionKevin Constantine2010-06-021-0/+1
| | | | | | | The nfsiostat man file was missing a linebreak before the --verbose option Signed-off-by: Kevin Constantine <kevin.constantine@disneyanimation.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: Convert colons in IPv6 presentation addresses tosemicolonsChuck Lever2010-05-241-3/+39
| | | | | | | | | | | | | | The /var/lib/nfs/rmtab file delineates fields in each of its lines with a ":". The first field contains the IP address of a client, in presentation format. IPv6 presentation format addresses contain colons, which screws up the field delineation of rmtab. Use a simple simple scheme to convert the colons in incoming client names to some other character, and then convert them back when the rmtab file is read. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Refactor rmtab_read()Chuck Lever2010-05-241-23/+41
| | | | | | | | Clean up: Make it easier to add IPv6 support by refactoring part of rmtab_read() into a helper function. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Mountd listens on 2 different versions for NFSv2 (MOUNTv1 and MOUNTv2)NeilBrown2010-05-241-6/+8
| | | | | | | | | | | | | | | | | | | | | and one for NFSv3 (MOUNTv3) When --no-nfs-version requests an NFS version to be disabled, the code actually disabled the MOUNT version. This works is several cases, but requires --no-nfs-version 1 to completely disable NFSv2, which is wrong. So if we do disable 1, 2, and 3. mountd complain and won't run, it is not possible to run just v4 - i.e. not listening for MOUNT requests at all (as v4 doesn't need them). So change the handling of "--no-nfs-version 2" it disable MOUNTv1 as well as MOUNTv2, and allow mountd to continue running as long as one of NFSv2 NFSv3 NFSv4 is enabled. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd/exportfs: Make m_addrlist field a nfs_sockaddrChuck Lever2010-05-055-17/+93
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* libexport.a: Clean up client_add()Chuck Lever2010-05-052-15/+12
| | | | | | | | | | | Clean up: client_add()'s current callers never set unknown m_type values, so the m_type check is unnecessary. All of client_add()'s callers are in the same source file where it is defined, so make it a static helper function. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Refactor client_init()Chuck Lever2010-05-051-43/+56
| | | | | | | | | | Clean up: Move subnet hostname parsing logic out of client_init() to make it simpler to introduce IPv6 support. Make client_init() a helper, since it's already static. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Make capabilities support optionalMike Frysinger2010-04-232-5/+17
| | | | | | | | | | The new code using libcap is quite minor, so rather than always reqiure libcap support, make it a normal --enable type flag. Current default behavior is retained -- if libcap is found, it is enabled, else it is disabled like every nfs-utils version in the past. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* set +x on autogen.shMike Frysinger2010-04-231-0/+0
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Allow malloc(3) failures in client_lookup() and friendsChuck Lever2010-04-231-6/+9
| | | | | | | | | | | | | Clean up: Use malloc(3) instead of xmalloc() in client_lookup() and client_dup(), ensuring that a failed memory allocation here doesn't cause our process to exit suddenly. Allocation of nfs_client records and the m_hostname string are now consistently handled with malloc(3), calloc(3), strdup(3), and free(3). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Allow m_hostname allocation to fail instead of exitChuck Lever2010-04-231-6/+4
| | | | | | | | | | | | Clean up: Replace xstrdup() with strdup(3) in client_init(), to prevent the process from exiting if the memory allocation fails. Note that both of client_init()'s callers set m_hostname equal to NULL before calling, thus the extra free(3) at the top of client_init() is unneeded. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Allow client_init() to fail instead of exitChuck Lever2010-04-231-7/+17
| | | | | | | | | client_init()'s current callers can now deal correctly with a failure. Get rid of code that can cause our process to exit in client_init(), if address mask parsing or memory allocation fails. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Add client_free()Chuck Lever2010-04-231-2/+8
| | | | | | | Clean up: Introduce a helper to free a nfs_client record. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Add in autoconf support for mountstats and nfsiostatsSteve Dickson2010-04-164-1/+29
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* Introduce man page for the nfsiostats commandSteve Dickson2010-04-161-0/+70
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* Introduce man page for the mountstats commandSteve Dickson2010-04-161-0/+32
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* Removed some miscellaneous warnings in the new gssd code.Steve Dickson2010-04-161-3/+3
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* Add support for non-DES encryption types.Kevin Coffman2010-04-163-48/+222
| | | | | | | Sends a new format of context information to the kernel. (Requires kernel support to do anything useful.) Signed-off-by: Steve Dickson <steved@redhat.com>
* Try to use kernel function to determine supported Kerberos enctypes.Kevin Coffman2010-04-162-3/+94
| | | | | | | | | This patch replaces a hard-coded list with a function to obtain the Kerberos encryption types that the kernel's rpcsec_gss code can support. Defaults to old behavior if kernel does not supply information. Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd: move function limit_krb5_enctypes into the exported functions areaKevin Coffman2010-04-161-55/+54
| | | | | | | | cleanup: Move function limit_krb5_enctypes() from the section containing static functions into the section containing externally visible functions. Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: export_find() should handle address parsing errorsChuck Lever2010-04-161-0/+4
| | | | | | | | | | | | | | | An address mask parsing error can cause client_init(), and therefore client_dup(), to make our process exit suddenly. Soon we want to add more complex address parsing in client_init(), so we need this interface to be a little more robust. Since export_find() can return NULL in some cases, it can handle NULL returns from its subroutines if an address parsing error occurs, or if memory is exhausted. Allow for client_dup() to return NULL instead of exiting sideways. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Add export_free()Chuck Lever2010-04-161-10/+17
| | | | | | | Clean up: Introduce a helper to free an nfs_export record. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Add helper for populating m_addrlist[]Chuck Lever2010-04-151-18/+20
| | | | | | | | | Clean up: Move common code that populates an nfs_client record's m_addrlist to a helper function. This eliminates a little code duplication, and makes it simpler to add IPv6 support later. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Reduce code duplication in client_init()Chuck Lever2010-04-151-4/+5
| | | | | | | | | Clean up: Most cases in client_init() set clp->m_naddr to zero. Move it to the common part of the function, and simplify the logic. This will make adding IPv6 support here more straightforward. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* set +x on t0001-statd-basic-mon-unmon.shMike Frysinger2010-04-151-0/+0
| | | | | | | | The test framework tries to exec this script, but it fails because it lacks the +x bit. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: replace xlog(L_FATAL) in client_check()Chuck Lever2010-04-081-4/+9
| | | | | | | | | | | Clean up: Prevent the process from exiting in client_check(). Report bad m_type values, but return 0. This removes another site where a mountd or exportfs process can exit sideways. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Refactor wildcard checking in client_check()Chuck Lever2010-04-081-12/+26
| | | | | | | | | | Clean up: refactor wildcard logic out of client_check() to make it easier to introduce IPv6 support. Match the style used for client_check_{fqdn,subnetwork,netgroup}. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Refactor netgroup checking in client_check()Chuck Lever2010-04-081-40/+57
| | | | | | | | | | | | | | | | | | Clean up: refactor netgroup logic out of client_check() to make it easier to introduce IPv6 support. + Use preferred style of keeping #ifdef out of the middle of function definitions. Squelch compiler warnings for "#ifndef HAVE_INNETGR" by using __attribute__((unused)). + Use preferred style of not using curly braces around switch cases. + Match style used for check_{fqdn,subnetwork}. + Clarify comment documenting use of h_aliases Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Remove unused function client_checkaddr()Chuck Lever2010-04-081-7/+0
| | | | | | | Clean up. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Factor SUBNETWORK checking out of check_client()Chuck Lever2010-04-081-10/+22
| | | | | | | | | | | | | | | | | | | | Clean up: Factor the MCL_SUBNETWORK case out of check_client() and client_checkaddr(). This will make it easier to add IPv6 support eventually. The logic in the new helper function will get a little more tangled once IPv6 support is introduced. Each slot in the clp address list eventually may contain an address from either address family. Note that the switch statement in client_checkaddr() is redundant, since clp->cl_mtype is loop invariant. This change makes SUBNETWORK client checking more computationally efficient, at the cost of a few extra lines of code. This commit should not change code behavior in any way. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Factor FQDN checking out of check_client()Chuck Lever2010-04-081-8/+23
| | | | | | | | | | | | | | | | | | | | Clean up: Factor the MCL_FQDN case out of check_client() and client_checkaddr(). This will make it easier to add IPv6 support eventually. The logic in the new helper function will get a little more tangled once IPv6 support is introduced. Each slot in the clp address list eventually may contain an address from either address family. Note that the switch statement in client_checkaddr() is redundant, since clp->cl_mtype is loop invariant. This change makes FQDN client checking more computationally efficient, at the cost of a few extra lines of code. This commit should not change code behavior in any way. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Remove some warnings that were introduced by commit 6ca440cSteve Dickson2010-04-082-1/+3
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: e_fslocdata should be freed with free(3)Chuck Lever2010-03-221-1/+1
| | | | | | | | Clean up: Since e_fslocdata is allocated with strdup(3), and not xstrdup(), it should be freed with free(3), and not xfree(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Fix whitespace damage in support/export/export.cChuck Lever2010-03-221-5/+6
| | | | | | | Clean up whitespace damage introduced by commit 4cacc965. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Clean up client_compose() and client_member()Chuck Lever2010-03-222-17/+29
| | | | | | | | Clean up: Replace outdated comments, and fix some function declarations. Use proper type for a couple of automatic variables. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: Remove dead codeChuck Lever2010-03-222-24/+0
| | | | | | | | Clean up: I can't find any call sites for client_find() or client_match(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount: Mount should retry unreachable hostsChuck Lever2010-03-191-0/+1
| | | | | | | | | | | | | | | | | | | | | Currently if a server is up but not responding (ie, it answers ARP requests, but not NFS or RPC requests), mount retries or backgrounds itself waiting for the server. If the server is not responding on the network at all, mount fails the mount request immediately. Users might find it more useful if mount retried in both cases. Note that this change means attempting to mount using a misspelled server name will "hang" for the retry amount. I suppose the error message isn't very helpful whether it fails immediately or waits a couple of minutes, though I imagine that an unreachable server is a much more common occurrence than a misspelling. Reported-by: Daniel Goering <g_daniel@gmx.net> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* sm-notify: Send fully-qualified and unqualified mon_namesChuck Lever2010-03-191-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During any file locking interaction between an NFS client and server, the client tells the server what hostname it will use as the mon_name argument of the SM_NOTIFY request sent by the client when it reboots. This is the "caller_name" argument of an NLMPROC_LOCK request. The server, however, never tells the client what mon_name argument it will use when sending an SM_NOTIFY request. In order to recognize the server, clients usually guess what mon_name the server might send, by using the server hostname provided by the user on the mount command line. Frequently, the user provides an unqualified server name on the mount command. The server might then call the client back with a fully qualified domain name, which might not match in some cases. Solaris, and perhaps other implementations, attempt to mitigate this problem by sending two SM_NOTIFY requests to each peer: one with an unqualified mon_name argument, and one with a fully qualified mon_name. Implement such a scheme for sm-notify. Since my_name is almost always the fully-qualified hostname associated with the local system, just wiping the left-most '.' in the my_name argument and sending another SM_NOTIFY is nearly always sufficient. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* sm-notify: Use my_name when sending SM_NOTIFY requestsChuck Lever2010-03-173-36/+47
| | | | | | | | | | | | | | | | | | | | | | The mon_name argument of an SM_NOTIFY request is a string that identifies the rebooting host. sm-notify should send the my_name provided by the local lockd at the time the remote was monitored, rather than cocking up a mon_name argument based on the present return value of gethostname(3). If the local system's hostname happened to change after the last reboot, then the string returned by gethostname(3) will not be recognized by the remote. Thus the remote will never initiate lock recovery for the original named host, possibly leaving stale locks. The existing behavior of using the -v command line option as the mon_name argument is preserved, but we now prevent sending an IP presentation address, as some non-Linux implementations don't recognize addresses as valid mon_names. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: trivial: name parameters for clarityJ. Bruce Fields2010-03-081-4/+4
| | | | | | | | | | Part of the reason for the previous bug was confusion between "subpath" and "path"; which is the shorter path, and which the longer? "child" and "parent" seem less ambiguous. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: fix path comparison for v4 crossmntJ. Bruce Fields2010-03-081-1/+1
| | | | | | | | This was obviously wrong, since path[strlen(path)] == '\0' should always be true. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>