summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2016-12-17 12:34:32 -0500
committerSteve Dickson <steved@redhat.com>2016-12-20 13:29:04 -0500
commit232185c5250337ede03357b82ef89b7983d5d754 (patch)
tree20ca00527cc05ccee4e95ccb563d1b0ed8d349a0
parent280cf0b8be7760e552458149c31ba33967865806 (diff)
downloadnfs-utils-232185c5250337ede03357b82ef89b7983d5d754.tar.gz
nfs-utils-232185c5250337ede03357b82ef89b7983d5d754.tar.xz
nfs-utils-232185c5250337ede03357b82ef89b7983d5d754.zip
nfsd: add /etc/nfs.conf support for host=
A comma separate list of hosts can be given. If any host name is given with "--host" or "-H", then all hosts listed in nfs.conf are ignored. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--systemd/nfs.conf.man1
-rw-r--r--utils/nfsd/nfsd.c15
-rw-r--r--utils/nfsd/nfsd.man7
3 files changed, 23 insertions, 0 deletions
diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
index 23aa4ea..2713bb0 100644
--- a/systemd/nfs.conf.man
+++ b/systemd/nfs.conf.man
@@ -104,6 +104,7 @@ for details.
.B nfsd
Recognized values:
.BR threads ,
+.BR host ,
.BR port ,
.BR grace-time ,
.BR lease-time ,
diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index 7c72bf0..8ee8bf0 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -63,6 +63,7 @@ main(int argc, char **argv)
char *p, *progname, *port, *rdma_port = NULL;
char **haddr = NULL;
int hcounter = 0;
+ struct conf_list *hosts;
int socket_up = 0;
unsigned int minorvers = 0;
unsigned int minorversset = 0;
@@ -114,12 +115,26 @@ main(int argc, char **argv)
}
}
+ hosts = conf_get_list("nfsd", "host");
+ if (hosts && hosts->cnt) {
+ struct conf_list_node *n;
+ haddr = realloc(haddr, sizeof(char*) * hosts->cnt);
+ TAILQ_FOREACH(n, &(hosts->fields), link) {
+ haddr[hcounter] = n->field;
+ hcounter++;
+ }
+ }
+
while ((c = getopt_long(argc, argv, "dH:hN:V:p:P:sTUrG:L:", longopts, NULL)) != EOF) {
switch(c) {
case 'd':
xlog_config(D_ALL, 1);
break;
case 'H':
+ if (hosts) {
+ hosts = NULL;
+ hcounter = 0;
+ }
if (hcounter) {
haddr = realloc(haddr, sizeof(char*) * hcounter+1);
if(!haddr) {
diff --git a/utils/nfsd/nfsd.man b/utils/nfsd/nfsd.man
index bc00464..9381cf9 100644
--- a/utils/nfsd/nfsd.man
+++ b/utils/nfsd/nfsd.man
@@ -125,6 +125,13 @@ configuration file. Values recognized include:
.B threads
The number of threads to start.
.TP
+.B host
+A host name, or comma separated list of host names, that
+.I rpc.nfsd
+will listen on. Use of the
+.B --host
+option replaces all host names listed here.
+.TP
.B grace-time
The grace time, for both NFSv4 and NLM, in seconds.
.TP