Print this page
7569 statd support to run on a fixed port
Portions contributed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
7577 mountd support to run on a fixed port
Portions contributed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>


   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2016 Nexenta Systems, Inc.

  25  */
  26 
  27 /*
  28  * NFS specific functions
  29  */
  30 #include <stdio.h>
  31 #include <string.h>
  32 #include <ctype.h>
  33 #include <stdlib.h>
  34 #include <unistd.h>
  35 #include <zone.h>
  36 #include <errno.h>
  37 #include <locale.h>
  38 #include <signal.h>
  39 #include <strings.h>
  40 #include "libshare.h"
  41 #include "libshare_impl.h"
  42 #include <nfs/export.h>
  43 #include <pwd.h>
  44 #include <grp.h>


2545 #define PROTO_OPT_NFSD_PROTOCOL                 12
2546         {"nfsd_protocol",
2547             "protocol", PROTO_OPT_NFSD_PROTOCOL, OPT_TYPE_PROTOCOL, 0,
2548             SVC_NFSD, 0, 0},
2549 #define PROTO_OPT_NFSD_LISTEN_BACKLOG           13
2550         {"nfsd_listen_backlog",
2551             "listen_backlog", PROTO_OPT_NFSD_LISTEN_BACKLOG,
2552             OPT_TYPE_NUMBER, 0, SVC_NFSD, 0, INT32_MAX},
2553 #define PROTO_OPT_NFSD_DEVICE                   14
2554         {"nfsd_device",
2555             "device", PROTO_OPT_NFSD_DEVICE,
2556             OPT_TYPE_STRING, NULL, SVC_NFSD, 0, 0},
2557 #define PROTO_OPT_MOUNTD_LISTEN_BACKLOG         15
2558         {"mountd_listen_backlog",
2559             "mountd_listen_backlog", PROTO_OPT_MOUNTD_LISTEN_BACKLOG,
2560             OPT_TYPE_NUMBER, 64, SVC_NFSD|SVC_MOUNTD, 1, INT32_MAX},
2561 #define PROTO_OPT_MOUNTD_MAX_THREADS            16
2562         {"mountd_max_threads",
2563             "mountd_max_threads", PROTO_OPT_MOUNTD_MAX_THREADS,
2564             OPT_TYPE_NUMBER, 16, SVC_NFSD|SVC_MOUNTD, 1, INT32_MAX},








2565         {NULL}
2566 };
2567 
2568 /*
2569  * the protoset holds the defined options so we don't have to read
2570  * them multiple times
2571  */
2572 static sa_protocol_properties_t protoset;
2573 
2574 static int
2575 findprotoopt(char *name, int whichname)
2576 {
2577         int i;
2578         for (i = 0; proto_options[i].tag != NULL; i++) {
2579                 if (whichname == 1) {
2580                         if (strcasecmp(proto_options[i].name, name) == 0)
2581                         return (i);
2582                 } else {
2583                         if (strcasecmp(proto_options[i].tag, name) == 0)
2584                                 return (i);




   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2016 Nexenta Systems, Inc.
  25  * Copyright (c) 2014, 2016 by Delphix. All rights reserved.
  26  */
  27 
  28 /*
  29  * NFS specific functions
  30  */
  31 #include <stdio.h>
  32 #include <string.h>
  33 #include <ctype.h>
  34 #include <stdlib.h>
  35 #include <unistd.h>
  36 #include <zone.h>
  37 #include <errno.h>
  38 #include <locale.h>
  39 #include <signal.h>
  40 #include <strings.h>
  41 #include "libshare.h"
  42 #include "libshare_impl.h"
  43 #include <nfs/export.h>
  44 #include <pwd.h>
  45 #include <grp.h>


2546 #define PROTO_OPT_NFSD_PROTOCOL                 12
2547         {"nfsd_protocol",
2548             "protocol", PROTO_OPT_NFSD_PROTOCOL, OPT_TYPE_PROTOCOL, 0,
2549             SVC_NFSD, 0, 0},
2550 #define PROTO_OPT_NFSD_LISTEN_BACKLOG           13
2551         {"nfsd_listen_backlog",
2552             "listen_backlog", PROTO_OPT_NFSD_LISTEN_BACKLOG,
2553             OPT_TYPE_NUMBER, 0, SVC_NFSD, 0, INT32_MAX},
2554 #define PROTO_OPT_NFSD_DEVICE                   14
2555         {"nfsd_device",
2556             "device", PROTO_OPT_NFSD_DEVICE,
2557             OPT_TYPE_STRING, NULL, SVC_NFSD, 0, 0},
2558 #define PROTO_OPT_MOUNTD_LISTEN_BACKLOG         15
2559         {"mountd_listen_backlog",
2560             "mountd_listen_backlog", PROTO_OPT_MOUNTD_LISTEN_BACKLOG,
2561             OPT_TYPE_NUMBER, 64, SVC_NFSD|SVC_MOUNTD, 1, INT32_MAX},
2562 #define PROTO_OPT_MOUNTD_MAX_THREADS            16
2563         {"mountd_max_threads",
2564             "mountd_max_threads", PROTO_OPT_MOUNTD_MAX_THREADS,
2565             OPT_TYPE_NUMBER, 16, SVC_NFSD|SVC_MOUNTD, 1, INT32_MAX},
2566 #define PROTO_OPT_MOUNTD_PORT                   17
2567         {"mountd_port",
2568             "mountd_port", PROTO_OPT_MOUNTD_PORT,
2569             OPT_TYPE_NUMBER, 0, SVC_MOUNTD, 1, UINT16_MAX},
2570 #define PROTO_OPT_STATD_PORT                    18
2571         {"statd_port",
2572             "statd_port", PROTO_OPT_STATD_PORT,
2573             OPT_TYPE_NUMBER, 0, SVC_STATD, 1, UINT16_MAX},
2574         {NULL}
2575 };
2576 
2577 /*
2578  * the protoset holds the defined options so we don't have to read
2579  * them multiple times
2580  */
2581 static sa_protocol_properties_t protoset;
2582 
2583 static int
2584 findprotoopt(char *name, int whichname)
2585 {
2586         int i;
2587         for (i = 0; proto_options[i].tag != NULL; i++) {
2588                 if (whichname == 1) {
2589                         if (strcasecmp(proto_options[i].name, name) == 0)
2590                         return (i);
2591                 } else {
2592                         if (strcasecmp(proto_options[i].tag, name) == 0)
2593                                 return (i);