summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* 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-263-65/+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-286-38/+5
| | | | | | | | | | | | | | | | | 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-282-2/+4
| | | | | | | | | | | 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>
* Release 1.1.3Steve Dickson2008-07-271-1/+1
| | | | 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>
* It appears that a recent glibc update now enforces the requirement for a modeSteve Dickson2008-07-151-1/+7
| | | | | | | | | | parameter for open calls with the O_CREAT flag set. nfs-utils support code defines a function xflock used by exportfs and mountd that calls open with O_CREAT but no mode parameter. This causes exportfs and mountd to dump core, with the error message: *** invalid open64 call: O_CREAT without mode ***:rpc.mountd terminated 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>
* We want to continue to support building nfs-utils on systems that do notChuck Lever2008-07-151-1/+28
| | | | | | | | | | | | | | | | have IPv6-enabled RPC libraries and headers installed, so add a ./configure switch that allows distros to disable IPv6 functionality. This patch introduces the nfs-utils autotools configuration to the library and header dependencies that will be required in subsequent patches. Later patches can then be reordered more easily if these new dependencies are added in one heap. For now, --enable-ipv6 defaults to "no", so this patch should not result in any behavioral changes to the nfs-utils build process, by default. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Currently the "-s" option is ignored by the text-based mount interface. ToChuck Lever2008-07-151-0/+15
| | | | | | | | | | | | notify the kernel that sloppy mount option parsing is needed, add "sloppy" to the string of mount options passed to the kernel. The 2.6.23 - 2.6.26 kernels will fail the mount if "sloppy" is present, as they won't recognize it. To prevent them from ever seeing this option, have the mount command check the kernel version before appending the option. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Lots of parts of nfs-utils already depend on getaddrinfo(3).Chuck Lever2008-07-151-0/+3
| | | | | | | | | | | | We could find each instance where getaddrinfo(3) is invoked, wrap it with '#ifdef HAVE_GETADDRINFO', and provide equivalent logic without it, but that's a whole lot of work... and no-one has complained about this so far. So as a clean-up, let's simply add a hard dependency for it in configure.ac, and call it a day. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Clean up: add the traditional pre-processor safety check in headers underChuck Lever2008-07-158-10/+34
| | | | | | | | | | utils/mount to prevent them from being included multiple times. For headers that already have this, use a more unique macro name to reduce the probability that some other header may use the same macro. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Moved the kernel version-ing code into a new version.hChuck Lever2008-07-154-21/+55
| | | | | | | header file which allows the code to be shared Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Introduce a new DNS resolver function in utils/mount/network.c that usesChuck Lever2008-07-152-19/+61
| | | | | | | | | getaddrinfo(3), which supports AF_INET6, to resolve host names. Replace the guts of nfs_gethostbyname() with a call to the new function. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* The text-based mount command displays the rather inexplicable "mount:Chuck Lever2008-07-152-4/+10
| | | | | | | | | | | | | internal error" whenever it encounters a problem that is entirely unexpected by its designers. Let's beef that error message up to include instructions about reporting the problem, and fix the error code returned by the mount option rewriting logic so that also will no longer report "internal error". An error in there should generally only occur if there was an invalid mount option specified. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Updated both the mountstats and nfs-iostat scripts to used theChuck Lever2008-07-152-5/+5
| | | | | | | proper abbreviation for kilobytes per second (kB/s). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Ported the create_mtab() routine from util-linux-ng as wellChristiaan Welvaart2008-07-153-34/+86
| | | | | | | | some add_mtab() updates to better hand the instances where /etc/mtab does not exist or is not writable Signed-off-by: Christiaan Welvaart <cjw@daneel.dyndns.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* The rpc.gssd scans for any suitable kerberos ticket. In cross-realmLukas Hejtmanek2008-07-155-15/+165
| | | | | | | | | | environment this may not be the desired behaviour. Therefore a new option, -R preferred realm, is presented so that the rpc.gssd prefers tickets from this realm. By default, the default realm is preferred. Signed-off-by: Lukas Hejtmanek <xhejtman@ics.muni.cz> Signed-off-by: Kevin Coffman <kwc@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* The default expiration of kernel gss contexts is the expirationLukas Hejtmanek2008-07-154-4/+16
| | | | | | | | | | | | | | | | | of the Kerberos ticket used in its creation. (For contexts created using the Kerberos mechanism.) Thus kdestroy has no effect in nullifying the kernel context. This patch adds -t <timeout> option to rpc.gssd so that the client's administrator may specify a timeout for expiration of contexts in kernel. After this timeout, rpc.gssd is consulted to create a new context. By default, timeout is 0 (i.e., no timeout at all) which follows the previous behavior. Signed-off-by: Lukas Hejtmanek <xhejtman@ics.muni.cz> Signed-off-by: Kevin Coffman <kwc@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>
* gssd_setup_krb5_user_gss_ccache must return an error if no usable cache isLukas Hejtmanek2008-07-153-8/+8
| | | | | | | | found. Trying to use invalid default cache and continue is not good idea at all. Signed-off-by: Lukas Hejtmanek <xhejtman@ics.muni.cz> Signed-off-by: Kevin Coffman <kwc@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com>