summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/fs/nfs/nfsport.h2
-rw-r--r--sys/fs/nfsclient/nfs_clvfsops.c55
-rw-r--r--sys/fs/nfsclient/nfsargs.h104
-rw-r--r--sys/nfsclient/nfsargs.h6
4 files changed, 37 insertions, 130 deletions
diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h
index f061089..c21482d 100644
--- a/sys/fs/nfs/nfsport.h
+++ b/sys/fs/nfs/nfsport.h
@@ -372,7 +372,7 @@ struct ext_nfsstats {
#include <fs/nfs/xdr_subs.h>
#include <fs/nfs/nfscl.h>
#include <fs/nfs/nfsclstate.h>
-#include <fs/nfsclient/nfsargs.h>
+#include <nfsclient/nfsargs.h>
#include <fs/nfsclient/nfsmount.h>
/*
diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c
index a37dd51..7928c15 100644
--- a/sys/fs/nfsclient/nfs_clvfsops.c
+++ b/sys/fs/nfsclient/nfs_clvfsops.c
@@ -102,8 +102,9 @@ static void nfs_decode_args(struct mount *mp, struct nfsmount *nmp,
struct nfs_args *argp, const char *, struct ucred *,
struct thread *);
static int mountnfs(struct nfs_args *, struct mount *,
- struct sockaddr *, char *, u_char *, u_char *, u_char *,
- struct vnode **, struct ucred *, struct thread *, int);
+ struct sockaddr *, char *, u_char *, int, u_char *, int,
+ u_char *, int, struct vnode **, struct ucred *,
+ struct thread *, int);
static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *,
struct sockaddr_storage *, int *, off_t *,
struct timeval *);
@@ -503,11 +504,21 @@ nfs_mountdiskless(char *path,
struct vnode **vpp, struct mount *mp)
{
struct sockaddr *nam;
- int error;
+ int dirlen, error;
+ char *dirpath;
+ /*
+ * Find the directory path in "path", which also has the server's
+ * name/ip address in it.
+ */
+ dirpath = strchr(path, ':');
+ if (dirpath != NULL)
+ dirlen = strlen(++dirpath);
+ else
+ dirlen = 0;
nam = sodupsockaddr((struct sockaddr *)sin, M_WAITOK);
- if ((error = mountnfs(args, mp, nam, path, NULL, NULL, NULL, vpp,
- td->td_ucred, td, NFS_DEFAULT_NEGNAMETIMEO)) != 0) {
+ if ((error = mountnfs(args, mp, nam, path, NULL, 0, dirpath, dirlen,
+ NULL, 0, vpp, td->td_ucred, td, NFS_DEFAULT_NEGNAMETIMEO)) != 0) {
printf("nfs_mountroot: mount %s on /: %d\n", path, error);
return (error);
}
@@ -735,14 +746,10 @@ nfs_mount(struct mount *mp)
.readahead = NFS_DEFRAHEAD,
.wcommitsize = 0, /* was: NQ_DEFLEASE */
.hostname = NULL,
- /* args version 4 */
.acregmin = NFS_MINATTRTIMO,
.acregmax = NFS_MAXATTRTIMO,
.acdirmin = NFS_MINDIRATTRTIMO,
.acdirmax = NFS_MAXDIRATTRTIMO,
- .dirlen = 0,
- .krbnamelen = 0,
- .srvkrbnamelen = 0,
};
int error = 0, ret, len;
struct sockaddr *nam = NULL;
@@ -752,6 +759,7 @@ nfs_mount(struct mount *mp)
u_char nfh[NFSX_FHMAX], krbname[100], dirpath[100], srvkrbname[100];
char *opt, *name, *secname;
int negnametimeo = NFS_DEFAULT_NEGNAMETIMEO;
+ int dirlen, krbnamelen, srvkrbnamelen;
if (vfs_filteropt(mp->mnt_optnew, nfs_opts)) {
error = EINVAL;
@@ -1008,19 +1016,19 @@ nfs_mount(struct mount *mp)
strlcpy(srvkrbname, name, sizeof (srvkrbname));
else
snprintf(srvkrbname, sizeof (srvkrbname), "nfs@%s", hst);
- args.srvkrbnamelen = strlen(srvkrbname);
+ srvkrbnamelen = strlen(srvkrbname);
if (vfs_getopt(mp->mnt_optnew, "gssname", (void **)&name, NULL) == 0)
strlcpy(krbname, name, sizeof (krbname));
else
krbname[0] = '\0';
- args.krbnamelen = strlen(krbname);
+ krbnamelen = strlen(krbname);
if (vfs_getopt(mp->mnt_optnew, "dirpath", (void **)&name, NULL) == 0)
strlcpy(dirpath, name, sizeof (dirpath));
else
dirpath[0] = '\0';
- args.dirlen = strlen(dirpath);
+ dirlen = strlen(dirpath);
if (vfs_getopt(mp->mnt_optnew, "addr", (void **)&args.addr,
&args.addrlen) == 0) {
@@ -1034,8 +1042,9 @@ nfs_mount(struct mount *mp)
}
args.fh = nfh;
- error = mountnfs(&args, mp, nam, hst, krbname, dirpath, srvkrbname,
- &vp, td->td_ucred, td, negnametimeo);
+ error = mountnfs(&args, mp, nam, hst, krbname, krbnamelen, dirpath,
+ dirlen, srvkrbname, srvkrbnamelen, &vp, td->td_ucred, td,
+ negnametimeo);
out:
if (!error) {
MNT_ILOCK(mp);
@@ -1077,9 +1086,9 @@ nfs_cmount(struct mntarg *ma, void *data, int flags)
*/
static int
mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
- char *hst, u_char *krbname, u_char *dirpath, u_char *srvkrbname,
- struct vnode **vpp, struct ucred *cred, struct thread *td,
- int negnametimeo)
+ char *hst, u_char *krbname, int krbnamelen, u_char *dirpath, int dirlen,
+ u_char *srvkrbname, int srvkrbnamelen, struct vnode **vpp,
+ struct ucred *cred, struct thread *td, int negnametimeo)
{
struct nfsmount *nmp;
struct nfsnode *np;
@@ -1094,17 +1103,15 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
return (0);
} else {
MALLOC(nmp, struct nfsmount *, sizeof (struct nfsmount) +
- argp->krbnamelen + argp->dirlen + argp->srvkrbnamelen + 2,
- M_NEWNFSMNT, M_WAITOK);
- bzero((caddr_t)nmp, sizeof (struct nfsmount) +
- argp->krbnamelen + argp->dirlen + argp->srvkrbnamelen + 2);
+ krbnamelen + dirlen + srvkrbnamelen + 2,
+ M_NEWNFSMNT, M_WAITOK | M_ZERO);
TAILQ_INIT(&nmp->nm_bufq);
if (clval == 0)
clval = (u_int64_t)nfsboottime.tv_sec;
nmp->nm_clval = clval++;
- nmp->nm_krbnamelen = argp->krbnamelen;
- nmp->nm_dirpathlen = argp->dirlen;
- nmp->nm_srvkrbnamelen = argp->srvkrbnamelen;
+ nmp->nm_krbnamelen = krbnamelen;
+ nmp->nm_dirpathlen = dirlen;
+ nmp->nm_srvkrbnamelen = srvkrbnamelen;
if (td->td_ucred->cr_uid != (uid_t)0) {
/*
* nm_uid is used to get KerberosV credentials for
diff --git a/sys/fs/nfsclient/nfsargs.h b/sys/fs/nfsclient/nfsargs.h
deleted file mode 100644
index 4fce292..0000000
--- a/sys/fs/nfsclient/nfsargs.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*-
- * Copyright (c) 1989, 1993, 1995
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Rick Macklem at The University of Guelph.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef _NFSCLIENT_NFSARGS_H_
-#define _NFSCLIENT_NFSARGS_H_
-
-/*
- * Arguments to mount NFS
- */
-#define NFS_ARGSVERSION 4 /* change when nfs_args changes */
-struct nfs_args {
- int version; /* args structure version number */
- struct sockaddr *addr; /* file server address */
- int addrlen; /* length of address */
- int sotype; /* Socket type */
- int proto; /* and Protocol */
- u_char *fh; /* File handle to be mounted */
- int fhsize; /* Size, in bytes, of fh */
- int flags; /* flags */
- int wsize; /* write size in bytes */
- int rsize; /* read size in bytes */
- int readdirsize; /* readdir size in bytes */
- int timeo; /* initial timeout in .1 secs */
- int retrans; /* times to retry send */
- int readahead; /* # of blocks to readahead */
- int iothreadcnt; /* and count of assoc threads */
- int wcommitsize; /* Max. write commit size in bytes */
- char *hostname; /* server's name */
- int acregmin; /* cache attrs for reg files min time */
- int acregmax; /* cache attrs for reg files max time */
- int acdirmin; /* cache attrs for dirs min time */
- int acdirmax; /* cache attrs for dirs max time */
- int krbnamelen; /* KerberosV principal name "-P" */
- char *krbname;
- int dirlen; /* Mount pt path for NFSv4 */
- char *dirpath;
- int srvkrbnamelen; /* Server kerberos target principal */
- char *srvkrbname; /* and the name */
-};
-
-/*
- * NFS mount option flags
- */
-#define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */
-#define NFSMNT_WSIZE 0x00000002 /* set write size */
-#define NFSMNT_RSIZE 0x00000004 /* set read size */
-#define NFSMNT_TIMEO 0x00000008 /* set initial timeout */
-#define NFSMNT_RETRANS 0x00000010 /* set number of request retries */
-#define NFSMNT_DIRECTIO 0x00000020 /* set maximum grouplist size */
-#define NFSMNT_INT 0x00000040 /* allow interrupts on hard mount */
-#define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */
-#define NFSMNT_NFSV4 0x00000100 /* Use NFSv4 */
-#define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */
-#define NFSMNT_KERB 0x00000400 /* Use Kerberos authentication */
-#define NFSMNT_STRICT3530 0x00000800 /* Follow RFC3530 strictly */
-#define NFSMNT_WCOMMITSIZE 0x00001000 /* set max write commit size */
-#define NFSMNT_READAHEAD 0x00002000 /* set read ahead */
-#define NFSMNT_INTEGRITY 0x00004000 /* Use Integrity cksum - krb5i */
-#define NFSMNT_PRIVACY 0x00008000 /* Encrypt RPCs - krb5p */
-#define NFSMNT_RDIRPLUS 0x00010000 /* Use Readdirplus for V3 */
-#define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */
-#define NFSMNT_ACREGMIN 0x00040000
-#define NFSMNT_ACREGMAX 0x00080000
-#define NFSMNT_ACDIRMIN 0x00100000
-#define NFSMNT_ACDIRMAX 0x00200000
-#define NFSMNT_NOLOCKD 0x00400000 /* Locks are local */
-#define NFSMNT_ALLGSSNAME 0x00800000 /* All RPCs use host principal */
-#define NFSMNT_HASWRITEVERF 0x01000000 /* NFSv4 Write verifier */
-#define NFSMNT_HASSETFSID 0x02000000 /* Has set FSID */
-#define NFSMNT_RESVPORT 0x04000000 /* Use a reserved port (Bunk!!) */
-#define NFSMNT_AUTOM 0x08000000 /* Done by autofs */
-
-#endif /* _NFSCLIENT_NFSARGS_H_ */
diff --git a/sys/nfsclient/nfsargs.h b/sys/nfsclient/nfsargs.h
index 7ebf1a0..a46677a 100644
--- a/sys/nfsclient/nfsargs.h
+++ b/sys/nfsclient/nfsargs.h
@@ -78,7 +78,7 @@ struct nfs_args {
#define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */
/* 0x100 free, was NFSMNT_NQNFS */
#define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */
-/* 0x400 free, was NFSMNT_KERB */
+#define NFSMNT_KERB 0x00000400 /* Use RPCSEC_GSS/Krb5 */
#define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */
#define NFSMNT_WCOMMITSIZE 0x00001000 /* set max write commit size */
#define NFSMNT_READAHEAD 0x00002000 /* set read ahead */
@@ -93,5 +93,9 @@ struct nfs_args {
#define NFSMNT_NOLOCKD 0x00400000 /* Locks are local */
#define NFSMNT_NFSV4 0x00800000 /* Use NFS Version 4 protocol */
#define NFSMNT_HASWRITEVERF 0x01000000 /* NFSv4 Write verifier */
+#define NFSMNT_INTEGRITY 0x02000000 /* Use integrity with RPCSEC_GSS */
+#define NFSMNT_PRIVACY 0x04000000 /* Use privacy with RPCSEC_GSS */
+#define NFSMNT_ALLGSSNAME 0x08000000 /* Use principal for all accesses */
+#define NFSMNT_STRICT3530 0x10000000 /* Adhere strictly to RFC3530 */
#endif
OpenPOWER on IntegriCloud