Author: rmacklem
Date: Tue Nov  8 21:39:15 2016
New Revision: 308452
URL: https://svnweb.freebsd.org/changeset/base/308452

Log:
  MFC: r307890
  mountd(8) was erroneously setting the sysctl for the old NFS server
  when the new/default NFS server was running, for the "-n" option.
  
  This patch fixes the problem for stable/10 and stable/9.
  Since the new NFS server uses vfs.nfsd.nfs_privport == 0 by default,
  there wouldn't have been many users affected by the code not setting
  it to 0 when the "-n" option was specified.

Modified:
  stable/10/usr.sbin/mountd/mountd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/mountd/mountd.c
==============================================================================
--- stable/10/usr.sbin/mountd/mountd.c  Tue Nov  8 21:17:24 2016        
(r308451)
+++ stable/10/usr.sbin/mountd/mountd.c  Tue Nov  8 21:39:15 2016        
(r308452)
@@ -489,11 +489,20 @@ main(int argc, char **argv)
        rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec);
 
        if (!resvport_only) {
-               if (sysctlbyname("vfs.nfsrv.nfs_privport", NULL, NULL,
-                   &resvport_only, sizeof(resvport_only)) != 0 &&
-                   errno != ENOENT) {
-                       syslog(LOG_ERR, "sysctl: %m");
-                       exit(1);
+               if (run_v4server != 0) {
+                       if (sysctlbyname("vfs.nfsd.nfs_privport", NULL, NULL,
+                           &resvport_only, sizeof(resvport_only)) != 0 &&
+                           errno != ENOENT) {
+                               syslog(LOG_ERR, "sysctl: %m");
+                               exit(1);
+                       }
+               } else {
+                       if (sysctlbyname("vfs.nfsrv.nfs_privport", NULL, NULL,
+                           &resvport_only, sizeof(resvport_only)) != 0 &&
+                           errno != ENOENT) {
+                               syslog(LOG_ERR, "sysctl: %m");
+                               exit(1);
+                       }
                }
        }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to