-/* $OpenBSD: nfs_socket.c,v 1.7 1996/07/03 07:10:33 deraadt Exp $ */
+/* $OpenBSD: nfs_socket.c,v 1.8 1996/12/24 20:14:29 dm Exp $ */
/* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */
/*
/*
* Some servers require that the client port be a reserved port number.
+ * We always allocate a reserved port, as this prevents filehandle
+ * disclosure through UDP port capture.
*/
- if (saddr->sa_family == AF_INET && (nmp->nm_flag & NFSMNT_RESVPORT)) {
+ if (saddr->sa_family == AF_INET) {
MGET(m, M_WAIT, MT_SONAME);
sin = mtod(m, struct sockaddr_in *);
sin->sin_len = m->m_len = sizeof (struct sockaddr_in);
-/* $OpenBSD: nfs_vfsops.c,v 1.14 1996/12/17 03:46:39 dm Exp $ */
+/* $OpenBSD: nfs_vfsops.c,v 1.15 1996/12/24 20:14:32 dm Exp $ */
/* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */
/*
args.fh = ndmntp->ndm_fh;
args.fhsize = NFSX_V2FH;
args.hostname = ndmntp->ndm_host;
- args.flags = NFSMNT_RESVPORT;
#ifdef NFS_BOOT_OPTIONS
args.flags |= NFS_BOOT_OPTIONS;
s = splsoftnet();
+#if 0
/* Re-bind if rsrvd port requested and wasn't on one */
adjsock = !(nmp->nm_flag & NFSMNT_RESVPORT)
&& (argp->flags & NFSMNT_RESVPORT);
+#endif
/* Update flags atomically. Don't change the lock bits. */
nmp->nm_flag =
argp->deadthresh <= NQ_NEVERDEAD)
nmp->nm_deadthresh = argp->deadthresh;
- if (argp->flags & NFSMNT_ACTIMES) {
+ if (argp->flags & NFSMNT_ACREGMIN && argp->acregmin >= 0) {
+ if (argp->acregmin > 0xffff)
+ nmp->nm_acregmin = 0xffff;
+ else
+ nmp->nm_acregmin = argp->acregmin;
+ }
+ if (argp->flags & NFSMNT_ACREGMAX && argp->acregmax >= 0) {
if (argp->acregmax > 0xffff)
nmp->nm_acregmax = 0xffff;
- else if (argp->acregmax >= 0)
+ else
nmp->nm_acregmax = argp->acregmax;
- if (argp->acregmin >= 0) {
- if (argp->acregmin > nmp->nm_acregmax)
- nmp->nm_acregmin = nmp->nm_acregmax;
- else
- nmp->nm_acregmin = argp->acregmin;
- }
+ }
+ if (nmp->nm_acregmin > nmp->nm_acregmax)
+ nmp->nm_acregmin = nmp->nm_acregmax;
+
+ if (argp->flags & NFSMNT_ACDIRMIN && argp->acdirmin >= 0) {
+ if (argp->acdirmin > 0xffff)
+ nmp->nm_acdirmin = 0xffff;
+ else
+ nmp->nm_acdirmin = argp->acdirmin;
+ }
+ if (argp->flags & NFSMNT_ACDIRMAX && argp->acdirmax >= 0) {
if (argp->acdirmax > 0xffff)
nmp->nm_acdirmax = 0xffff;
- else if (argp->acdirmax >= 0)
+ else
nmp->nm_acdirmax = argp->acdirmax;
- if (argp->acdirmin >= 0) {
- if (argp->acdirmin > nmp->nm_acdirmax)
- nmp->nm_acdirmin = nmp->nm_acdirmax;
- else
- nmp->nm_acdirmin = argp->acdirmin;
- }
}
+ if (nmp->nm_acdirmin > nmp->nm_acdirmax)
+ nmp->nm_acdirmin = nmp->nm_acdirmax;
if (nmp->nm_so && adjsock) {
nfs_disconnect(nmp);
if (args.version == 3) {
error = copyin (data, (caddr_t)&args,
sizeof (struct nfs_args3));
- args.flags &= ~NFSMNT_INTERNAL;
+ args.flags &= ~(NFSMNT_INTERNAL|NFSMNT_NOAC);
}
- else if (args.version == NFS_ARGSVERSION)
+ else if (args.version == NFS_ARGSVERSION) {
error = copyin(data, (caddr_t)&args, sizeof (struct nfs_args));
+ args.flags &= ~NFSMNT_NOAC; /* XXX - compatibility */
+ }
else
return (EPROGMISMATCH);
if (error)
return (error);
- args.flags |= NFSMNT_RESVPORT; /* ALWAYS allocate one */
if (mp->mnt_flag & MNT_UPDATE) {
register struct nfsmount *nmp = VFSTONFS(mp);
-/* $OpenBSD: mount.h,v 1.11 1996/12/17 03:46:36 dm Exp $ */
+/* $OpenBSD: mount.h,v 1.12 1996/12/24 20:14:35 dm Exp $ */
/* $NetBSD: mount.h,v 1.48 1996/02/18 11:55:47 fvdl Exp $ */
/*
/*
* NFS mount option flags
*/
+#ifndef _KERNEL
+#define NFSMNT_RESVPORT 0x00000000 /* always use reserved ports */
+#endif /* !_KERNEL */
#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_LEASETERM 0x00001000 /* set lease term (nqnfs) */
#define NFSMNT_READAHEAD 0x00002000 /* set read ahead */
#define NFSMNT_DEADTHRESH 0x00004000 /* set dead server retry thresh */
-#define NFSMNT_RESVPORT 0x00008000 /* Allocate a reserved port */
+#ifdef _KERNEL /* Coming soon to a system call near you! */
+#define NFSMNT_NOAC 0x00008000 /* disable attribute cache */
+#endif /* _KERNEL */
#define NFSMNT_RDIRPLUS 0x00010000 /* Use Readdirplus for V3 */
#define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */
/* Flags valid only in mount syscall arguments */
-#define NFSMNT_ACTIMES 0x00040000 /* Args contain attr cache times*/
+#define NFSMNT_ACREGMIN 0x00040000 /* acregmin field valid */
+#define NFSMNT_ACREGMAX 0x00080000 /* acregmax field valid */
+#define NFSMNT_ACDIRMIN 0x00100000 /* acdirmin field valid */
+#define NFSMNT_ACDIRMAX 0x00200000 /* acdirmax field valid */
/* Flags valid only in kernel */
#define NFSMNT_INTERNAL 0xfffc0000 /* Bits set internally */