summaryrefslogtreecommitdiffstats
path: root/utils/mount/network.h
Commit message (Collapse)AuthorAgeFilesLines
* pdate addres for Free Software FoundationNeilBrown2011-08-291-2/+2
| | | | | | | | | | | | License texts contain multiple address for FSF, some wrong. So update them and replace COPYING file with http://www.gnu.org/licenses/gpl-2.0.txt which has a few changes to preamble and commentary. Also remove extra COPYING file from utils/statd/ Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount: move generic functions to utils.c and network.cKarel Zak2011-04-061-0/+3
| | | | | | | | | Move generic code that could be shared between standard mount.nfs and libmount version to utils.c and network.c. CC: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Remove nfs_name_to_address()Chuck Lever2009-12-111-1/+0
| | | | | | | Clean up: nfs_name_to_address() has no more callers. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Add new API for getting protocol family from netidsChuck Lever2009-12-111-0/+2
| | | | | | | | Introduce a couple of new functions that extract the protocol family from the value of the proto= and mountproto= mount options. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: make nfs_lookup() globalChuck Lever2009-12-111-0/+2
| | | | | | | | Expose a DNS query API that allows callers to request DNS results from a specific address family. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Introducing the parsing of both 'defaultvers' and 'defaultproto'Steve Dickson2009-10-221-0/+2
| | | | | | | | | | | config variables which will be used to set the the default version and network protocol. A global variable will be set for each option with the corresponding value. The value will be used as the initial value in the server negation. Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Support "-t nfs,vers=4" mounts in the kernelChuck Lever2009-09-141-0/+1
| | | | | | | | | | | | | | Support "vers=4" in nfs_nfs_version() Skip UMNT call for "-t nfs -o vers=4" mounts For "-t nfs -o vers=4" mounts, we want to skip v2/v3 version/transport negotiation, but be sure to append the "clientaddr" option. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com> Tested-by: Steve Dickson <steved@redhat.com>
* mount.nfs: remove unused @addrlen argument from nfs_string_to_sockaddr()Chuck Lever2009-07-141-2/+1
| | | | | | | | | | Address compiler warning: network.c: In function nfs_string_to_sockaddr: network.c:272: warning: unused parameter addrlen Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: make nfs_options2pmap return errorsChuck Lever2009-07-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Up until now, nfs_options2pmap() has been passed mount options that have already gone through the kernel's parser successfully. So, it never had to check for invalid mount option values. However, we are about to pass it options that come right from the user. So nfs_options2pmap() will now need to report an error and fail if it encounters a bogus value for any of the options it cares about. ===== Note that nfs_options2pmap() will allow a bogus value for an option if the same option is specified farther to the right with a useable value. For example, if a user specifies "proto=foo,...,tcp" then nfs_options2pmap() uses "tcp" and ignores "proto=foo". However, if the options are specified in the other order: "tcp,...,proto=foo" then nfs_options2pmap() will fail. This is a simple and unambiguous extension of the "rightmost wins" rule. Since mount.nfs strips out these options out and replaces them with the rpcbind-negotiated options before invoking mount(2), the kernel should never receive bogus values for these options from mount.nfs in such cases. This is probably slightly more flexible behavior than the legacy mount implementation, but should be harmless. All mount options unrelated to pmap are ignored by nfs_options2pmap(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount: remove legacy version of nfs_name_to_address()Chuck Lever2009-05-181-2/+1
| | | | | | | | | | | | | | | | | | | | | | | Currently we have two separate copies of nfs_name_to_address() since some older glibc's don't define AI_ADDRCONFIG. This means extra work to build- and run-test both functions when code is changed in this area. It is also the case that gethostbyname(3) is deprecated, and should not be used in new code. Remove the legacy code in favor of always using getaddrinfo(3). We can also get rid of nfs_name_to_address()'s @family argument as well. Note also this addresses a bug in nfsumount.c -- it was calling nfs_name_to_address() with AF_UNSPEC unconditionally, even if the legacy version of nfs_name_to_address(), which doesn't support AF_UNSPEC, was in use. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* umount.nfs command: Add an AF_INET6-capable version of nfs_call_unmount()Chuck Lever2009-02-171-1/+3
| | | | | | | | | | | | | | | | | | We need an AF_INET6-capable version of nfs_call_unmount() to allow the umount.nfs command to support unmounting NFS servers over IPv6. The legacy mount.nfs command still likes to use nfs_call_umount(), so we leave it in place and introduce a new API that can take a "struct sockaddr *". The umount.nfs command will invoke this new API, but we'll leave the legacy mount.nfs command and the umount.nfs4 command alone. The umount.nfs4 command does not need this support because NFSv4 unmount operations are entirely local. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* text-based mount command: Function to stuff "struct pmap" from mount optionsChuck Lever2009-01-271-0/+5
| | | | | | | | | Both the text-based mount.nfs command and the umount.nfs command need to fill in a pmap structure based on string mount options. Introduce a shared function that can do this. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount command: AF_INET6 support for probe_bothports()Chuck Lever2008-12-111-0/+3
| | | | | | | | | | | | | | | | Introduce an AF_INET6 capable probe_bothports() API. This means replacing "struct sockaddr_in *" arguments with a "struct sockaddr *" and a socklen_t arguments. These functions often combine a "struct sockaddr_in" and a "struct pmap" into a single "clnt_addr_t" argument. Instead of modifying "clnt_addr_t" and all the legacy code that uses it, I'm going to create a new probe_bothports() API for the text-based mount command that takes a "struct sockaddr *" and sockaddr length, and leave the existing probe_bothports() interface, which takes "clnt_addr_t" arguments, for legacy use. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Clean up: Include the bare minimum of legacy RPC headers inChuck Lever2008-07-151-10/+0
| | | | | | | utils/mount/network.h. 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-151-1/+0
| | | | | | | command. 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-151-0/+2
| | | | | | | | | | | | | | 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-151-0/+4
| | | | | | | string and back. 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-151-0/+5
| | | | | | | | | | 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>
* Introduce a new DNS resolver function in utils/mount/network.c that usesChuck Lever2008-07-151-0/+2
| | | | | | | | | 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>
* mount.nfs: Create a new API to find out client's addressChuck Lever2007-08-251-0/+1
| | | | | | | | | | | | Provide a version of clnt_ping() that discovers the client's address, but doesn't do an RPC ping. The in-kernel text-based mount code already does a ping, so all we need here is address discovery. As well, add a block comment in front of clnt_ping() that hopefully elucidates the differences. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* libnfs.a: eliminate conn.c and conn.hChuck Lever2007-07-301-1/+20
| | | | | | | conn.[ch] are now no longer needed. Clean them out and delete them. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* libnfs.a: move clnt_ping() to utils/mountChuck Lever2007-07-301-0/+3
| | | | | | | | | | Continue clean up of mount functionality in libnfs.a by moving clnt_ping() to utils/mount/network.c. Note that socklen_t is an unsigned int... the i386 gcc compiler threw a signedness warning about the 3rd argument of getsockname(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* libnfs.a: move more mount-only functions out of libnfs.aChuck Lever2007-07-301-0/+2
| | | | | | | Continue clean-up with nfsvers_to_mnt() and mntvers_to_nfs(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* libnfs.a: move mnt_{open, close}clnt calls to utils/mount/network.cChuck Lever2007-07-301-0/+6
| | | | | | | | | | | | | | | | | It turns out that get_socket() accesses a global variable, "verbose," that is only available in the mount command; yet it's in libnfs.a. This creates an undocumented API dependency that will bite someone someday. This mount-specific functionality doesn't really belong in libnfs.a anyway. The simplest way to resolve this is to move all of the functions in support/nfs/conn.c into utils/mount. network.c seems like the logical place to put these. An added benefit is we eventually get to make get_socket() static. Let's start with the mnt_{open,close}clnt functions. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* umount.nfs: move nfs_call_umount to network.cChuck Lever2007-07-301-4/+3
| | | | | | | | | nfs_call_umount() is shared by nfsmount.c and nfsumount.c, and manages a network function (building the RPC umount call to the server's MNT daemon). So move it to network.c with other network-related functions. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Move start_statd into nfs_mountChuck Lever2007-07-201-2/+3
| | | | | | | | | | | | | | Move start_startd into network.c, and move the call inside of nfs_mount, instead of immediately after - conceptually a better place for it. Also fix a minor nit: Since the mount actually fails if start_statd doesn't work, cause mount.nfs to exit with a status of EX_FAIL. Still need to do something about "running_bg" in nfsmount.c:nfsmount(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Move network functions into a common source moduleChuck Lever2007-07-201-0/+31
Separate network oriented functions from filesystem oriented functions, for general cleanliness. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>