summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/nfs/nfs.h9
-rw-r--r--sys/nfs/nfs_subs.c4
-rw-r--r--sys/nfs/nfs_syscalls.c3
-rw-r--r--sys/nfs/nfs_vfsops.c6
4 files changed, 15 insertions, 7 deletions
diff --git a/sys/nfs/nfs.h b/sys/nfs/nfs.h
index 6956ce54b26..56840a40208 100644
--- a/sys/nfs/nfs.h
+++ b/sys/nfs/nfs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs.h,v 1.15 2001/12/19 08:58:06 art Exp $ */
+/* $OpenBSD: nfs.h,v 1.16 2002/01/11 01:20:56 nate Exp $ */
/* $NetBSD: nfs.h,v 1.10.4.1 1996/05/27 11:23:56 fvdl Exp $ */
/*
@@ -225,12 +225,14 @@ struct nfsstats {
*/
#define NFS_NFSSTATS 1 /* struct: struct nfsstats */
#define NFS_NIOTHREADS 2 /* number of i/o threads */
-#define NFS_MAXID 3
+#define NFS_NORSVPORT 3 /* if > 0, don't require reserved port */
+#define NFS_MAXID 4
#define FS_NFS_NAMES { \
{ 0, 0 }, \
{ "nfsstats", CTLTYPE_STRUCT }, \
- { "iothreads", CTLTYPE_INT } \
+ { "iothreads", CTLTYPE_INT }, \
+ { "norsvport", CTLTYPE_INT } \
}
/*
@@ -243,6 +245,7 @@ struct nfsstats {
*/
#ifdef _KERNEL
extern int nfs_niothreads;
+extern int nfs_norsvport;
struct uio; struct buf; struct vattr; struct nameidata; /* XXX */
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c
index 38a91d45245..15dded43510 100644
--- a/sys/nfs/nfs_subs.c
+++ b/sys/nfs/nfs_subs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_subs.c,v 1.38 2001/12/19 08:58:06 art Exp $ */
+/* $OpenBSD: nfs_subs.c,v 1.39 2002/01/11 01:20:56 nate Exp $ */
/* $NetBSD: nfs_subs.c,v 1.27.4.3 1996/07/08 20:34:24 jtc Exp $ */
/*
@@ -1654,7 +1654,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag)
saddr = mtod(nam, struct sockaddr_in *);
if (saddr->sin_family == AF_INET &&
- (ntohs(saddr->sin_port) >= IPPORT_RESERVED ||
+ ((ntohs(saddr->sin_port) >= IPPORT_RESERVED && !nfs_norsvport) ||
(slp->ns_so->so_type == SOCK_STREAM && ntohs(saddr->sin_port) == 20))) {
vput(*vpp);
return (NFSERR_AUTHERR | AUTH_TOOWEAK);
diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c
index 87c1618a4a4..35653cc1479 100644
--- a/sys/nfs/nfs_syscalls.c
+++ b/sys/nfs/nfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_syscalls.c,v 1.22 2001/12/19 08:58:06 art Exp $ */
+/* $OpenBSD: nfs_syscalls.c,v 1.23 2002/01/11 01:20:56 nate Exp $ */
/* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */
/*
@@ -108,6 +108,7 @@ int nfs_niothreads = -1;
#ifdef NFSSERVER
static void nfsd_rt __P((int, struct nfsrv_descript *, int));
+int nfs_norsvport = 0;
#endif
int nfs_clientd(struct nfsmount *nmp, struct ucred *cred,
diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c
index 4b7733156c8..2790e6ca1fb 100644
--- a/sys/nfs/nfs_vfsops.c
+++ b/sys/nfs/nfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vfsops.c,v 1.42 2001/12/19 08:58:06 art Exp $ */
+/* $OpenBSD: nfs_vfsops.c,v 1.43 2002/01/11 01:20:56 nate Exp $ */
/* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */
/*
@@ -931,6 +931,10 @@ nfs_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
return rv;
+ case NFS_NORSVPORT:
+ rv = sysctl_int(oldp, oldlenp, newp, newlen, &nfs_norsvport);
+ return rv;
+
default:
return EOPNOTSUPP;
}