aboutsummaryrefslogtreecommitdiff
path: root/sbin/mount_nfs/mount_nfs.c
Commit message (Collapse)AuthorAgeFilesLines
* Align the buffer to the alignment of the structure we expect.Gleb Smirnoff2020-03-051-1/+1
| | | | | | | Submitted by: Slawa Olhovchenkov <slw zxy.spb.ru> Notes: svn path=/head/; revision=358686
* When a machine boots the NFS mounting script is executed afterGleb Smirnoff2020-03-041-1/+61
| | | | | | | | | | | | | | | | interfaces are configured, but for many interfaces (e.g. all Intel) ifconfig causes link renegotiation, so the first attempt to mount NFS always fails. After that mount_nfs sleeps for 30 seconds, while only a couple seconds are actually required for interface to get up. Instead of sleeping, do select(2) on routing socket and check if some interface became UP and in this case retry immediately. Reviewed by: rmacklem Differential Revision: https://reviews.freebsd.org/D23934 Notes: svn path=/head/; revision=358655
* Fix mount_nfs to recognize the NFSv4 specific errors returned by nmount(2).Rick Macklem2019-12-261-5/+11
| | | | | | | | | | | | | | | | | | | When mount_nfs calls nmount(2), certain NFSv4 specific errors such as NFSERR_MINORVERMISMATCH can be returned. Without this patch, 10021 is reported as an unknown error. This is not particulcarily serious, but make it difficult for sysadmins to figure out why the mount attempt is failing. This patch uses nfsv4_errstr.h to convert 10021 and similar to error strings that can be printed out. A positive side effect of this patch is the removal of a reference to sys/nfsclient/nfs.h, which should no longer be used, since it is part of the old NFS client. This patch should only affect reporting of failed mount attempts and not the semantics of NFS mount attempts. Notes: svn path=/head/; revision=356101
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-1/+3
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* Fix mount_nfs so that it doesn't create mounttab entries for NFSv4 mounts.Rick Macklem2017-05-081-1/+1
| | | | | | | | | | | | | The NFSv4 protocol doesn't use the Mount protocol, so it doesn't make sense to add an entry for an NFSv4 mount to /var/db/mounttab. Also, r308871 modified umount so that it doesn't remove any entry created by mount_nfs. Reported on freebsd-current@. Reported by: clbuisson@orange.fr MFC after: 2 weeks Notes: svn path=/head/; revision=317931
* Remove support for long gone oldnfs.Brooks Davis2017-04-071-22/+7
| | | | | | | | | | | | | | | The code was calling nmount with an fstype of everything in the program name after the last '_'. This was there to support mount_nfs being linked to mount_oldnfs. Support for the link was removed in 2015 with r281691. Reviewed by: rmacklem Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D10301 Notes: svn path=/head/; revision=316619
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Cleanup unnecessary semicolons from utilities we all love.Pedro F. Giffuni2016-04-151-1/+1
| | | | Notes: svn path=/head/; revision=298089
* mount_nfs: Be more clear on nmount(2) error with errmsg unsetConrad Meyer2015-07-221-1/+2
| | | | | | | | | | | Differential Revision: https://reviews.freebsd.org/D3147 Reviewed by: rmacklem Approved by: markj (mentor) MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=285804
* Since the case where secflavor < 0 indicates the security flavor isRick Macklem2015-07-071-2/+2
| | | | | | | | | | | | | | | to be negotiated, it could be a Kerberized mount. As such, filling in the "principal" argument using the canonized host name makes sense. If it is negotiated as AUTH_SYS, the "principal" argument is meaningless but harmless. Requested by: masato@itc.naist.jp Tested by: masato@itc.naist.jp PR: 201073 MFC after: 1 month Notes: svn path=/head/; revision=285260
* Build mount_nfs(8) with WARNS=6.Edward Tomasz Napierala2014-10-311-48/+58
| | | | | | | | | Reviewed by: rmacklem@ MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=273896
* Remove two functions unused after r273848. Would be nice if clangEdward Tomasz Napierala2014-10-301-29/+0
| | | | | | | | | | or at least scan-build yelled about it. MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=273861
* Add support for "timeo", "actimeo", "noac", and "proto" optionsEdward Tomasz Napierala2014-10-301-0/+29
| | | | | | | | | | | | to mount_nfs(8). They are implemented on Linux, OS X, and Solaris, and thus can be expected to appear in automounter maps. Reviewed by: rmacklem@ MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=273849
* Get rid of obsolete code in mount_nfs(8).Edward Tomasz Napierala2014-10-301-217/+2
| | | | | | | | Reviewed by: rmacklem@ Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=273848
* Provide -o vers= support for mount_nfs.Bjoern A. Zeeb2014-08-051-0/+26
| | | | | | | | | | | | | | | | Our mount_nfs does use -o nfsv<2|3|4> or -2 or -3 to specify the version. OSX (these days), Solaris, and Linux use -o vers=<2,3,4>. With the upcoming autofs support we can make a lot of (entrerprisy) setups getting mount options from LDAP just work by providing -o vers= compatibility. PR: 192379 Reviewed by: wblock, bjk (man page), rmacklem, emaste MFC after: 3 days Sponsored by: DARPA,AFRL Notes: svn path=/head/; revision=269583
* GC unused variables. Prefer NULL over 0 for pointers.Jung-uk Kim2013-03-051-7/+6
| | | | Notes: svn path=/head/; revision=247856
* Change checkpath() to not exit on error. This is a prerequisite forJaakko Heinonen2012-01-161-1/+2
| | | | | | | | | | fixing the mount(8) "failok" option. PR: 163668 Reviewed by: Garrett Cooper, delphij (previous version) Notes: svn path=/head/; revision=230226
* Spelling fixes for sbin/Ulrich Spörlein2012-01-071-1/+1
| | | | Notes: svn path=/head/; revision=229778
* Finish making 'wcommitsize' an NFS client mount option.John Baldwin2011-11-141-0/+7
| | | | | | | | Reviewed by: rmacklem MFC after: 1 week Notes: svn path=/head/; revision=227507
* This patch changes head so that the default NFS client is now the newRick Macklem2011-04-271-8/+4
| | | | | | | | | | | | | | | | | NFS client (which I guess is no longer experimental). The fstype "newnfs" is now "nfs" and the regular/old NFS client is now fstype "oldnfs". Although mounts via fstype "nfs" will usually work without userland changes, an updated mount_nfs(8) binary is needed for kernels built with "options NFSCL" but not "options NFSCLIENT". Updated mount_nfs(8) and mount(8) binaries are needed to do mounts for fstype "oldnfs". The GENERIC kernel configs have been changed to use options NFSCL and NFSD (the new client and server) instead of NFSCLIENT and NFSSERVER. For kernels being used on diskless NFS root systems, "options NFSCL" must be in the kernel config. Discussed on freebsd-fs@. Notes: svn path=/head/; revision=221124
* Fix deprecated warning about -L which said -i was deprecated.Simon L. B. Nielsen2010-12-261-1/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=216725
* Correct a typo.Jaakko Heinonen2010-10-271-1/+1
| | | | | | | | | PR: 151321 Submitted by: Simon Walton MFC after: 3 days Notes: svn path=/head/; revision=214419
* Shut the compiler up; initializes the sotype variable to zero inKevin Lo2010-09-041-0/+1
| | | | | | | | | nfs_tryproto(). Reviewed by: rmacklem Notes: svn path=/head/; revision=212195
* Introduce '[ipaddr]:path' notation.Hajimu UMEMOTO2010-02-041-6/+16
| | | | | | | | | | | | | | Since the existing implementation searches ':' backward, a path which includes ':' could not be mounted. You can now mount such path by enclosing an IP address by '[]'. Though we should change to search ':' forward, it will break 'ipv6addr:path' which is currently working. So, it still searches ':' backward, at least for now. MFC after: 2 weeks Notes: svn path=/head/; revision=203490
* static'ify function prototypes and convert K&R to ANSI.Xin LI2010-02-031-24/+23
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=203461
* Fix parsing of mount options specified with -o in case an option withJaakko Heinonen2009-10-261-5/+5
| | | | | | | | | | | | value is preceded by an option without value (for example -o option1,option2=value). Options must be separated before searching for '='. Also compare pnextopt explicitly against NULL. PR: bin/134069 Approved by: trasz (mentor) Notes: svn path=/head/; revision=198491
* Change the default transport protocol for use by the Mount protocolRick Macklem2009-09-171-1/+1
| | | | | | | | | | | | | | from UDP to TCP, so that it is consistent with TCP for NFS, which became the default at r176198. Without this change, doing an NFS mount against a server that only supports UDP would result in an unusable mount point if a transport protocol option wasn't specified for the mount. Approved by: kib (mentor) MFC after: 3 days Notes: svn path=/head/; revision=197298
* Don't use sys/nfs/rpcv2.h - it is part of the old kernel RPC implementationDoug Rabson2009-06-241-12/+12
| | | | | | | and will be removed. Notes: svn path=/head/; revision=194880
* Code for parsing nmount options in kernel was mergedCraig Rodrigues2009-06-011-1/+1
| | | | | | | | | to stable/7 branch in r190315. So only resort to fallback_mount() could which passes struct nfs_args to kernel in kernel versions less than 702100. Notes: svn path=/head/; revision=193191
* Add support for the experimental nfs client to mount_nfs. TheRick Macklem2009-05-271-5/+91
| | | | | | | | | | | | | | | experimental client is used when the fstype is "newnfs" or the "nfsv4" option is specified. It includes the addition of the option: gssname - to specify a client side initiator host based principal name which is specific to NFSv4. It also includes a change to mount.c, so that it knows about mount_newnfs, but not mount_nfs4. Reviewed by: dfr Approved by: kib (mentor) Notes: svn path=/head/; revision=192930
* Remove the unmaintained University of Michigan NFSv4 client from 8.xRobert Watson2009-05-221-251/+4
| | | | | | | | | | prior to 8.0-RELEASE. Rick Macklem's new and more feature-rich NFSv234 client and server are replacing it. Discussed with: rmacklem Notes: svn path=/head/; revision=192578
* Set NFSMNT_ACDIRMAX flag in fallback_mount() function.Craig Rodrigues2009-02-061-0/+1
| | | | Notes: svn path=/head/; revision=188218
* Set NFSMNT_ACREGMIN, NFSMNT_ACREGMAX, and NFSMNT_ACDIRMIN flagsCraig Rodrigues2009-02-061-0/+9
| | | | | | | | | | | in fallback_mount() function. Add a comment to indicate that the fallback_mount() function should eventually go away. Submitted by: Jaakko Heinonen <jh saunalahti fi> Notes: svn path=/head/; revision=188217
* Fix parsing of acregmin, acregmax, acdirmin and acdirmax NFS mount optionsCraig Rodrigues2009-01-281-4/+4
| | | | | | | | | when passed as strings via nmount(). Submitted by: Jaakko Heinonen <jh saunalahti fi> Notes: svn path=/head/; revision=187812
* Implement support for RPCSEC_GSS authentication to both the NFS clientDoug Rabson2008-11-031-1/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and server. This replaces the RPC implementation of the NFS client and server with the newer RPC implementation originally developed (actually ported from the userland sunrpc code) to support the NFS Lock Manager. I have tested this code extensively and I believe it is stable and that performance is at least equal to the legacy RPC implementation. The NFS code currently contains support for both the new RPC implementation and the older legacy implementation inherited from the original NFS codebase. The default is to use the new implementation - add the NFS_LEGACYRPC option to fall back to the old code. When I merge this support back to RELENG_7, I will probably change this so that users have to 'opt in' to get the new code. To use RPCSEC_GSS on either client or server, you must build a kernel which includes the KGSSAPI option and the crypto device. On the userland side, you must build at least a new libc, mountd, mount_nfs and gssd. You must install new versions of /etc/rc.d/gssd and /etc/rc.d/nfsd and add 'gssd_enable=YES' to /etc/rc.conf. As long as gssd is running, you should be able to mount an NFS filesystem from a server that requires RPCSEC_GSS authentication. The mount itself can happen without any kerberos credentials but all access to the filesystem will be denied unless the accessing user has a valid ticket file in the standard place (/tmp/krb5cc_<uid>). There is currently no support for situations where the ticket file is in a different place, such as when the user logged in via SSH and has delegated credentials from that login. This restriction is also present in Solaris and Linux. In theory, we could improve this in future, possibly using Brooks Davis' implementation of variant symlinks. Supporting RPCSEC_GSS on a server is nearly as simple. You must create service creds for the server in the form 'nfs/<fqdn>@<REALM>' and install them in /etc/krb5.keytab. The standard heimdal utility ktutil makes this fairly easy. After the service creds have been created, you can add a '-sec=krb5' option to /etc/exports and restart both mountd and nfsd. The only other difference an administrator should notice is that nfsd doesn't fork to create service threads any more. In normal operation, there will be two nfsd processes, one in userland waiting for TCP connections and one in the kernel handling requests. The latter process will create as many kthreads as required - these should be visible via 'top -H'. The code has some support for varying the number of service threads according to load but initially at least, nfsd uses a fixed number of threads according to the value supplied to its '-n' option. Sponsored by: Isilon Systems MFC after: 1 month Notes: svn path=/head/; revision=184588
* Use the version of the kernel returned by getosreldate()Craig Rodrigues2008-09-191-6/+16
| | | | | | | | | | to determine whether to call the fallback_mount() backwards compatibility function or not. Reviewed by: dfr Notes: svn path=/head/; revision=183182
* Instead of building up a "struct nfs_args" to pass to the kernelCraig Rodrigues2008-09-131-291/+406
| | | | | | | | | | | | | | | | | | via nmount(), build up an iovec where each iovec member is an NFS mount option, and pass the iovec down to the kernel via nmount(). These options are then parsed in the kernel. This should make it easier to add new NFS mount options in future. Many, many thanks to Doug Rabson for taking my initial patches, and cleaning them up. In addition, Doug added a fallback_mount() function so that the newer mount_nfs program will work against older kernels, to facilitate upgrading/downgrading scenarios. Doug also re-wrote the mount_nfs.8 man page. Reviewed by: dfr Notes: svn path=/head/; revision=183008
* Fix -o mntudp after the conversion to default TCP mountsKris Kennaway2008-07-101-1/+4
| | | | | | | | Submitted by: danfe MFC after: 1 week Notes: svn path=/head/; revision=180435
* Undo the damage I did in sys/kern/vfs_mount.c #1.274 andYaroslav Tykhiy2008-02-181-9/+0
| | | | | | | | | | sbin/mount_nfs/mount_nfs.c #1.76. Let the dragons sleep. Requested by: rodrigc, des PR: kern/120319 (welcome the bug back) Notes: svn path=/head/; revision=176394
* Add a work-around to make it possible again to remountYaroslav Tykhiy2008-02-181-0/+9
| | | | | | | | | | | | | | NFS root r/w. The real solution would be to bring the whole nmount(2) framework, including FS drivers and userland tools, into a consistent state at last; but things should work in the meantime, too. Reported by: kris Notes: svn path=/head/; revision=176384
* Back out rev. 1.74 because the kernel isn't ready yetYaroslav Tykhiy2008-02-181-8/+1
| | | | | | | to see NFS specific string options. Notes: svn path=/head/; revision=176377
* Don't forget to prepare string options for nmount(2).Yaroslav Tykhiy2008-02-181-1/+8
| | | | | | | | | | Otherwise things won't work as intended, e.g., it'll be impossible to upgrade NFS root mount to read-write. Reported by: kris Notes: svn path=/head/; revision=176376
* Switch the default NFS mount mode from UDP to TCP. UDP mounts are aKris Kennaway2008-02-111-1/+1
| | | | | | | | | | | | | historical relic, and are no longer appropriate for either LAN or WAN mounting. At modern (gigabit and 10 gigabit) LAN speeds packet loss from socket buffer fill events is common, and sequence numbers wrap quickly enough that data corruption is possible. TCP solves both of these problems without imposing significant overhead. MFC after: 1 month Notes: svn path=/head/; revision=176198
* Add "fg" option as antonym to "bg"; add "hard" option as antonym to "soft".Thomas Quinot2007-03-051-0/+2
| | | | | | | | | | | This is for better compatibility with other environments (Linux, Solaris, HP-UX, AIX and Tru64 support these options). PR: bin/109924 MFC after: 1 week Notes: svn path=/head/; revision=167236
* Merge mount_nfs4.c and mount_nfs.c into one program.Craig Rodrigues2007-01-231-5/+244
| | | | | | | | | | | | | | If argv[0] == "mount_nfs4", then default to mounting NFSv4, otherwise if argv[0] == "mount_nfs", default to the old mount_nfs behavior. - Add a -4 option. - Add the University of Michigan copyright from mount_nfs4.c, for the code merged from mount_nfs4.c. Reviewed by: rees Notes: svn path=/head/; revision=166183
* Pass a string buffer named "errmsg" to nmount().Craig Rodrigues2006-11-291-2/+4
| | | | | | | | | | | This will allow the NFS mount code to return a string error message in addition to returning an error integer value. Reviewed by: mohans MFC after: 1 month Notes: svn path=/head/; revision=164733
* Deduce the "fstype" parameter to pass to nmount() by looking atCraig Rodrigues2006-11-291-2/+8
| | | | | | | | | | | the "_nfs" part of argv[0]. This should facilitate unifying mount_nfs and mount_nfs4 into one binary. MFC after: 1 month Reviewed by: mohans Notes: svn path=/head/; revision=164732
* Fix last element of nc_protos[] array to appease GCC.Craig Rodrigues2006-11-211-1/+1
| | | | Notes: svn path=/head/; revision=164458
* Convert mount_nfs from old mount(2) API to new nmount(2) API.Craig Rodrigues2006-11-211-1/+11
| | | | | | | Reviewed by: mohans Notes: svn path=/head/; revision=164457
* Minor style(9) and KNF elimination as I prepare to fix a bug.Warner Losh2006-03-201-14/+8
| | | | Notes: svn path=/head/; revision=156925