summaryrefslogtreecommitdiffstats
path: root/utils
Commit message (Collapse)AuthorAgeFilesLines
...
* showmount command: move logic to acquire RPC client handle out of main()Chuck Lever2008-11-251-52/+64
| | | | | | | | | | In preparation to support IPv6 in the showmount command, extract the logic that parses/acquires the target hostname and converts it into an RPC client handle to contact the remote mountd service, and move it into its own function. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* showmount command: Remove unused local getport() implementationChuck Lever2008-11-251-105/+0
| | | | | | | | Clean up: remove showmount.c's local getport() implementation, now that the showmount command uses the shared one. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* showmount command: call nfs_getport instead of local getportChuck Lever2008-11-251-6/+8
| | | | | | | | | | Have the showmount command invoke the shared nfs_getport() function instead of its own local version. This gives the showmount command immediate support for querying via rpcbindv3/v4 in addition to portmapper, and sets the stage for AF_INET6 support in showmount. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* sm-notify should exit as soon as its determinedPhil Endecott2008-10-141-3/+10
| | | | | | | there are no hosts to notify. This also decreases start up time by a few seconds. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs(5): Clarify behavior of the mountproto= and proto= optionsChuck Lever2008-10-081-0/+85
| | | | | | | | Document the interaction between the mountproto= and the proto= mount options in a new subsection of nfs(5). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Cleaned up the wording in the rpc.nfsd(8) manpageSteve Dickson2008-10-011-1/+1
| | | | | | (BZ: https://bugzilla.linux-nfs.org/show_bug.cgi?id=159) Signed-off-by: Steve Dickson <steved@redhat.com>
* Cleared up a contradiction in the export(5) man pageSteve Dickson2008-10-011-1/+1
| | | | | | (BZ: https://bugzilla.linux-nfs.org/show_bug.cgi?id=161) Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: change "unknown host" error message to "unmatched host"Jeff Layton2008-09-291-1/+1
| | | | | | | | | | | | | mount request from unknown host 10.11.14.99 for /export The hosts are listed in DNS with proper reverse records, so the reason why the host is "unknown" isn't clear. This patch just changes the wording of this error to hopefully make it more clear why the mount request was rejected. This also makes this error message use a format more similar to the other error messages in auth_authenticate(). Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs(5): Replace the term "netid" in mount option descriptionsChuck Lever2008-09-291-8/+8
| | | | | | | | | | | | | | | | | | | | | | | TI-RPC introduced the concept of "netid" which is a string that is mapped to a set of transport capabilities via a netconfig database. RPC services register a netid and bindaddr with their local rpcbind daemon to advertise their ability to support particular transports. Mike Eisler noted that the use of the term "netid" in nfs(5) is not appropriate, since Linux does not treat the value of the proto= or mountproto= options as a netid proper, but rather to select a particular transport capability provided locally on the client. The Linux NFS client currently uses a simple internal mapping between these names and its own transport capabilities rather than using the names as part of an rpcbind query, thus these strings are really not netids. They are more akin to what TI-RPC calls "protocol names". Remove the term "netid" from nfs(5) for now. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Cc: Mike Eisler <mike.eisler@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs(5): Replace the term "netid" in mount option descriptionsChuck Lever2008-09-291-6/+6
| | | | | | | | | | | | Mike Eisler noted that the use of the term "netid" in the descriptions of the "proto=" option is not appropriate, since Linux does not allow "udp6" or "tcp6". Replaced the term "netid" with "transport" in nfs(5). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Tom Talpey <Thomas.Talpey@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.statd: Stop overloading sockfd in utils/statd/rmtcall.cChuck Lever2008-09-263-14/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Linux kernel's lockd requires that rpc.statd perform notification callbacks from a privileged source port. To guarantee rpc.statd gets a privileged source port but runs unprivileged, it calls statd_get_socket() then drops root privileges before starting it's svc request processing loop. Statd's svc request loop is the only caller of the process_foo() functions in utils/statd/rmtcall.c, but one of them, process_notify_list() attempts to invoke statd_get_socket() again. In today's code, this is unneeded because statd_get_socket() is always invoked before my_svc_run(). However, if it ever succeeded, it would get an unprivileged source port anyway, causing the kernel to reject all subsequent requests from statd. Thus the process_notify_list() function should not ever call statd_get_socket() because root privileges have been dropped by this point, and statd_get_socket() wouldn't get a privileged source port, causing the kernel to reject all subsequent SM_NOTIFY requests. So all of the process_foo functions in utils/statd/rmtcall.c should use the global sockfd instead of a local copy, as it already has a privileged source port. I've seen some unexplained behavior where statd starts making calls to the kernel via an unprivileged port. This could be one way that might occur. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.statd: Use __func__ in dprintfChuck Lever2008-09-261-23/+27
| | | | | | | | | | | | Clean up: The named function in many of the debugging messages in utils/statd/rmtcall.c is out of date. To prevent this from happening in the future, replace these with __func__. Also, note() and dprintf() do not require a terminating '\n' in their format string. So make all invocations consistent. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.statd: Clean up: replace "if (!(foo = rtnl))".Chuck Lever2008-09-262-6/+6
| | | | | | | | | | | | Static code checkers flag this kind of thing because it's easy to confuse with "if (!(foo == rtnl))". In one of these cases, the combination of evaluation and assignment isn't even necessary. While we are in the neighborhood, remove an extra argument to note() that is not called for in the passed-in format string. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* showmount: destroy RPC client when finishedChuck Lever2008-09-261-0/+4
| | | | | | | | | Clean up: call clnt_destroy() in the showmount command as needed to destroy the RPC client properly (and close the associated socket) before the program exits. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* sm-notify command: use static function definitionsChuck Lever2008-09-261-10/+10
| | | | | | | | | | | | | | | | Clean up. The sm-notify command is built from a single source file. Some of its internal functions are appropriately defined as static. However, some are declared static, but defined as global. Some are declared and defined as global. None of them are used outside of utils/statd/sm-notify.c. Make all the internal functions in utils/statd/sm-notify.cstatic. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* sm-notify command: replace nsm_address typedefChuck Lever2008-09-261-66/+63
| | | | | | | | | Clean up: replace "typedef struct sockaddr_storage nsm_address" with standard socket address types. This makes sm-notify.c consistent with other parts of nfs-utils, and with typical network application coding conventions. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* sm-notify command: clean up error loggingChuck Lever2008-09-261-19/+29
| | | | | | | | | | | | | | | | | | | | | | Clean up a few issues with logging in sm-notify.c. Sometimes in sm-notify, when a system call fails the problem is reported to stderr but not logged, and then usually sm-notify exits. In cases like this, there are probably more hosts to notify, but sm-notify dies silently. Make sure these errors are logged, and that the log messages explain the nature of the problem. Also, if sm-notify exits prematurely, make sure this is always reported at the LOG_ERR level, not at the LOG_WARNING level. Remove a couple of unnecessary '\n' in the arguments of nsm_log() calls -- nsm_log() already appends an '\n' to the message. Finally, use exit() consistently in main(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* sm-notify command: getaddrinfo(3) addrinfo leakChuck Lever2008-09-261-1/+4
| | | | | | | | | | | Make sure the results of getaddrinfo(3) are properly freed in notify(). Note this is a one-time addrinfo allocation that would be automatically freed when sm-notify exits anyway, so this is more of a nit than a real bug fix. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* sm-notify command: include <config.h>Chuck Lever2008-09-261-2/+4
| | | | | | | | Clean up: Include config.h as other source files do; instead of using "config.h" use the HAVE_CONFIG_H macro and include <config.h>. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* showmount command: clean up error returns from connect_nb()Chuck Lever2008-09-261-10/+12
| | | | | | | | | | | | | Clean up connect_nb() in the showmount command. Sometimes it returns -1 on error, and sometimes a negative errno. On error, it should always return one of these or the other, not both. Similar functions in other parts of nfs-utils return -1 on error, and set errno; so let's do that here too. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.statd: eliminate --secure_statdChuck Lever2008-09-262-56/+13
| | | | | | | | | | | | | | | | | | | | | | | Clean up: Remove RESTRICTED_STATD to help make IPv6 changes simpler. We keep the code behind RESTRICTED_STATD, and toss anything that is compiled out when it is set. RESTRICTED_STATD was added almost 10 years ago in response to CERT CERT CA-99.05, which addresses exposures in rpc.statd that might allow an attacker to take advantage of buffer overflows in rpc.statd while it is running in privileged mode. These days, I can't think of a reason why anyone would want to run rpc.statd without setting RESTRICTED_STATD. In addition, I don't think rpc.statd is ever tested without it. Removing RESTRICTED_STATD will get rid of some address storage and comparison issues that will make IPv6 support simpler. Plus it will make our test matrix smaller! Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Acked-by: Neil Brown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.tatd: refactor check to see if call is from loopback addressChuck Lever2008-09-261-46/+36
| | | | | | | | | | | | | | Refactor common logic to check if SM_FOO request is from loopback address. We'll have to do something about this for IPv6. On IPv6-capable systems, there will be only one AF_INET6 listener. The loopback caller will get either an IPv6 loopback address, or a mapped IPv4 loopback -- either way this will be an AF_INET6 address. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Acked-by: Neil Brown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount: enable retry for nfs23 to set the correct protocol for mount.Neil Brown2008-08-281-2/+4
| | | | | | | | | | Use a connected port when talking to portmap via UDP. This allows us to get ICMP errors reported back so we can avoid timeouts. Also catch the error (RPC_CANTRECV) properly in getport. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* Remove idmapd.confJ. Bruce Fields2008-08-281-10/+0
| | | | | | | | The example idmapd.conf file is kept in libnfsidmap now, which is what's responsible for parsing it anyway. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* Determine supported pseudoflavors from exportJ. Bruce Fields2008-08-281-17/+38
| | | | | | | | Instead of using a static list of supported flavors, we should be taking the list from the export. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* Minor mountd.c cleanupJ. Bruce Fields2008-08-281-38/+49
| | | | | | | | | I find it more readable to have the normal (non-error) case unindented, and to keep conditionals relatively simple, as is the usual kernel style. Fix some inconsistent indentation while we're there. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* Remove redundant m_path fieldJ. Bruce Fields2008-08-282-13/+3
| | | | | | | | | | | | | | | | | Contrary to the comment above its definition, the field m_path always has the same value as e_path: the *only* modifications of m_path are all of the form: strncpy(exp->m_export.m_path, exp->m_export.e_path, sizeof (exp->m_export.m_path) - 1); exp->m_export.m_path[sizeof (exp->m_export.m_path) - 1] = '\0'; So m_path is always just a copy of e_path. In places where we need to store a path to a submount of a CROSSMNT-exported filesystem, as in cache.c, we just use a local variable. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* Stop exportfs warning about needing fsid, when we actually have oneDavid Woodhouse2008-08-281-1/+9
| | | | | Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Use fsid from statfs for UUID if blkid can't cope (or not used)David Woodhouse2008-08-281-2/+11
| | | | | Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Explicit UUID handling doesn't require blkid; factor out get_uuid_blkdev()David Woodhouse2008-08-281-36/+41
| | | | | Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Fix handling of explicit uuidDavid Woodhouse2008-08-281-1/+3
| | | | | | | | | | | Fix a couple of bugs which show up if you try to explicitly set a 16-byte UUID when exporting a file system. First, exportfs cuts the first two bytes off the UUID and writes something invalid to etab. Second, mountd writes the _ascii_ form of the UUID to the kernel, instead of converting it to hex. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount issue with Mac OSX and --manage-gids, client hangsNeil Brown2008-08-271-1/+3
| | | | | | | | | Make sure are zero len group list is sent down to the kernel when the gids do not exist on the server. Tested-by: Alex Samad <alex@samad.com.au> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs command: old glibc missing some flagsChuck Lever2008-07-311-0/+18
| | | | | | | | | | | | | | | | Old versions of glibc (< 2.4) have a getaddrinfo(3) implementation, but do not include public definitions of the AI_V4MAPPED, AI_ALL, and AI_ADDRCONFIG flags because it was believed that these flags were not standardized. However, these flags have standard definitions both in POSIX 1003 and in RFCs, and were thus included in later releases of glibc. To allow the mount.nfs command to build on systems with these older versions of glibc, add conditional definitions for these flags in utils/mount/network.c. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* showmount issuesMartin Leisner2008-07-251-2/+4
| | | | | | | | The connect_nb() routne returns zero for success and a negative value for failure which was not being interpreted correctly by the getport() routine. This patch fixes that problem. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs(5) man page: Add documentation for the "mountproto=" optionChuck Lever2008-07-251-0/+19
| | | | | | | | Looks like mountproto= was never documented in nfs(5). Add a paragraph that describes it in the "nfs mount options" section. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* sm-notify: perform DNS lookup in the background.Steve Dickson2008-07-251-20/+40
| | | | | | | | | | | | | If an NFS server has no network connectivity when it reboots, it will block in sm-notify waiting for DNS lookup for a potentially large number of hosts. This is not helpful and just annoys the sysadmin. So do the DNS lookup in the backgrounded phase of sm-notify, before sending off the NOTIFY requests. Acked-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* If portmap is not listening on UDP (as apparently happens withNeil Brown2008-07-161-4/+15
| | | | | | | | | | | | | | | | | | | MS-Windows-Server2003R2SP2), then nfs mounts have to be mounted with -o mountproto=tcp to succeed. In this case a umount will still try UDP and will fail to contact the server. It will still succeed with the local unmount (after a timeout) but exits with a non-zero exit status. This causes /bin/mount to retry so we get a strange error about the filesystem not being mounted. So: get umount to use tcp if "mountproto=tcp" appears in mtab ignore any failure message from the server that would overwrite a success message from the local umount syscall. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* If an NFS server is only listening on TCP for portmap (as apparentlyNeil Brown2008-07-162-2/+29
| | | | | | | | | | | | | | | MS-Windows-Server2003R2SP2 does), mount doesn't cope. There is retry logic in case the initial choice of version/etc doesn't work, but it doesn't cope with mountd needing tcp. So: Fix probe_port so that a TIMEDOUT error doesn't simply abort but probes with other protocols (e.g. tcp). Fix rewrite_mount_options to extract the mountproto option before doing a probe, then set mountproto (and mount prot) based on the result. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* Clean up: Include the bare minimum of legacy RPC headers inChuck Lever2008-07-156-24/+9
| | | | | | | utils/mount/network.h. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Clean up: remove unneeded headers from utils/mount/stropts.c.Chuck Lever2008-07-151-11/+3
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Clean up: rename a couple of functions in utils/mount/stropts.c to matchChuck Lever2008-07-151-9/+9
| | | | | | | the naming convention of the others. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Clean up: remove unused IPv4-only functions used by the text-based mountChuck Lever2008-07-153-54/+0
| | | | | | | command. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Traditionally the mount command has looked for a ":" to separate theChuck Lever2008-07-155-82/+288
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | server's hostname from the export path in the mounted on device name, like this: mount server:/export /mounted/on/dir The server's hostname is "server" and the export path is "/export". You can also substitute a specific IPv4 network address for the server hostname, like this: mount 192.168.0.55:/export /mounted/on/dir Raw IPv6 addresses present a problem, however, because they look something like this: fe80::200:5aff:fe00:30b Note the use of colons. To get around the presence of colons, copy the Solaris convention used for raw NFS server IPv6 addresses, which is to wrap the raw IPv6 address with square brackets. This is also suggested in RFC 4038. Introduce a new device name parser that can support traditional device names and square brackets. Place the parser in a separate source file so both the mount and umount paths can derive the server's hostname and export pathname the same way. Bonus points: add a check for NFS URLs and display an appropriate error message in that case. This is cleaner than failing with "unknown host: nfs". Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Change the fix_mounthost_option() function to support resolving IPv6Chuck Lever2008-07-151-12/+21
| | | | | | | addresses. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Change the append_clientaddr_option() function to support sending eitherChuck Lever2008-07-151-14/+12
| | | | | | | | | | | IPv4 or IPv6 addresses to the kernel via the "clientaddr=" option. If the mount.nfs4 command can't determine an appropriate callback address, it used to fail the mount request. This new function simply sends an ANY address instead, so the mount request succeeds, but delegation is disabled. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Change the append_addr_option() function to support sending either IPv4Chuck Lever2008-07-151-15/+6
| | | | | | | or IPv6 addresses to the kernel via the "addr=" option. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* There are three helpers that convert sockaddr-style addresses to textChuck Lever2008-07-151-0/+31
| | | | | | | | | | | addresses, then construct mount options to pass these addresses to the kernel. The tail of each of these helpers does exactly the same thing, so introduce a helper that handles the common code. Magically, the new helper supports IPv6 as well as IPv4. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Introduce IPv6-enabled version of get_client_address. The legacy mountChuck Lever2008-07-152-0/+120
| | | | | | | | | | | | | | command could use this eventually as well. If this new function fails to discover an appropriate callback address, it fills in an ANY address to indicate to the server that it should not call the client back (ie delegations are disabled in this case). The user can specify a callback address via the clientaddr= mount option in this case to enable delegation. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Introduce two new functions to convert a sockaddr to a presentation formatChuck Lever2008-07-152-0/+96
| | | | | | | string and back. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Add #include directives for additional header files needed to support IPv6Chuck Lever2008-07-152-1/+7
| | | | | | | | networking. This is a separate patch so subsequent patches can be reordered without collision. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>