* [nfs-utils PATCH 0/10] More support for /etc/nfs.conf
@ 2016-12-08 4:27 NeilBrown
2016-12-08 4:27 ` [PATCH 02/10] nfsd: remove pointless memory allocations NeilBrown
` (11 more replies)
0 siblings, 12 replies; 14+ messages in thread
From: NeilBrown @ 2016-12-08 4:27 UTC (permalink / raw)
To: J. Bruce Fields, Steve Dickson; +Cc: linux-nfs
Added some missing support for rpc.nfsd, rpc.gss, rpc.svcgssd.
Fixed a bug.
Added generic support for "debug="
This only applies to tools which use the xlog() infrastructure.
blkmapd used syslog directly and gssd has it's own shim. I think
they should be converted to xlog rather than having separate debug=
support.
NeilBrown
---
NeilBrown (10):
nfsd: move and improve test on valid port
nfsd: remove pointless memory allocations.
nfsd: add /etc/nfs.conf support for nfsd.port option.
nfsd: add /etc/nfs.conf support for host=
conffile: allow embedded spaces in values.
conffile: fix striping of quotes from values.
xlog: Add common support for "debug=??" in /etc/nfs.conf
exportfs: allow debugging to be enabled in nfs.conf
gssd: add /etc/nfs.conf support
svcgssd: add /etc/nfs.conf support
support/include/xlog.h | 1 +
support/nfs/conffile.c | 24 ++++++++++-------
support/nfs/xlog.c | 14 ++++++++++
systemd/nfs.conf.man | 49 ++++++++++++++++++++++++++++++++++-
utils/exportfs/exportfs.c | 5 ++++
utils/exportfs/exportfs.man | 8 ++++++
utils/gssd/gssd.c | 29 +++++++++++++++++++++
utils/gssd/gssd.man | 54 +++++++++++++++++++++++++++++++++++++++
utils/gssd/svcgssd.c | 14 ++++++++++
utils/gssd/svcgssd.man | 17 ++++++++++++
utils/mountd/mountd.c | 1 +
utils/nfsd/nfsd.c | 48 +++++++++++++++++++++++------------
utils/nfsd/nfsd.man | 10 +++++++
utils/nfsdcltrack/nfsdcltrack.c | 1 +
utils/statd/sm-notify.c | 1 +
utils/statd/statd.c | 1 +
16 files changed, 249 insertions(+), 28 deletions(-)
--
Signature
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 01/10] nfsd: move and improve test on valid port
2016-12-08 4:27 [nfs-utils PATCH 0/10] More support for /etc/nfs.conf NeilBrown
2016-12-08 4:27 ` [PATCH 02/10] nfsd: remove pointless memory allocations NeilBrown
@ 2016-12-08 4:27 ` NeilBrown
2016-12-08 4:27 ` [PATCH 04/10] nfsd: add /etc/nfs.conf support for host= NeilBrown
` (9 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: NeilBrown @ 2016-12-08 4:27 UTC (permalink / raw)
To: J. Bruce Fields, Steve Dickson; +Cc: linux-nfs
nfssvc_set_sockets() access textual port numbers (by lookup in
/etc/services). This uses getaddrinfo which reports errors, except
for out-of-range numbers.
So change the test on a valid port to only complain if the port given
is purely numeric, but is out-of-range.
Also move it so that any default value gets tested the same as any
argument value.
Signed-off-by: NeilBrown <neilb@suse.com>
---
utils/nfsd/nfsd.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index 62b2876948c3..89179be76113 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -59,7 +59,7 @@ static struct option longopts[] =
int
main(int argc, char **argv)
{
- int count = NFSD_NPROC, c, i, error = 0, portnum = 0, fd, found_one;
+ int count = NFSD_NPROC, c, i, error = 0, portnum, fd, found_one;
char *p, *progname, *port, *rdma_port = NULL;
char **haddr = NULL;
int hcounter = 0;
@@ -132,12 +132,6 @@ main(int argc, char **argv)
case 'P': /* XXX for nfs-server compatibility */
case 'p':
/* only the last -p option has any effect */
- portnum = atoi(optarg);
- if (portnum <= 0 || portnum > 65535) {
- fprintf(stderr, "%s: bad port number: %s\n",
- progname, optarg);
- usage(progname);
- }
free(port);
port = xstrdup(optarg);
break;
@@ -245,6 +239,15 @@ main(int argc, char **argv)
xlog_open(progname);
+ portnum = strtol(port, &p, 0);
+ if (!*p && (portnum <= 0 || portnum > 65535)) {
+ /* getaddrinfo will catch other errors, but not
+ * out-of-range numbers.
+ */
+ xlog(L_ERROR, "invalid port number: %s", port);
+ exit(1);
+ }
+
/* make sure that at least one version is enabled */
found_one = 0;
for (c = NFSD_MINVERS; c <= NFSD_MAXVERS; c++) {
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 02/10] nfsd: remove pointless memory allocations.
2016-12-08 4:27 [nfs-utils PATCH 0/10] More support for /etc/nfs.conf NeilBrown
@ 2016-12-08 4:27 ` NeilBrown
2016-12-08 4:27 ` [PATCH 01/10] nfsd: move and improve test on valid port NeilBrown
` (10 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: NeilBrown @ 2016-12-08 4:27 UTC (permalink / raw)
To: J. Bruce Fields, Steve Dickson; +Cc: linux-nfs
There is not need to e.g. strdup(optarg), and the value is constant.
It can just be used directly.
Signed-off-by: NeilBrown <neilb@suse.com>
---
utils/nfsd/nfsd.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index 89179be76113..d8f873ba3717 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -71,8 +71,8 @@ main(int argc, char **argv)
int grace = -1;
int lease = -1;
- progname = xstrdup(basename(argv[0]));
- port = xstrdup("nfs");
+ progname = basename(argv[0]);
+ port = "nfs";
haddr = xmalloc(sizeof(char *));
haddr[0] = NULL;
@@ -126,14 +126,13 @@ main(int argc, char **argv)
exit(1);
}
}
- haddr[hcounter] = xstrdup(optarg);
+ haddr[hcounter] = optarg;
hcounter++;
break;
case 'P': /* XXX for nfs-server compatibility */
case 'p':
/* only the last -p option has any effect */
- free(port);
- port = xstrdup(optarg);
+ port = optarg;
break;
case 'r':
rdma_port = "nfsrdma";
@@ -334,11 +333,7 @@ set_threads:
if ((error = nfssvc_threads(count)) < 0)
xlog(L_ERROR, "error starting threads: errno %d (%m)", errno);
out:
- free(port);
- for(i=0; i < hcounter; i++)
- free(haddr[i]);
free(haddr);
- free(progname);
return (error != 0);
}
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 03/10] nfsd: add /etc/nfs.conf support for nfsd.port option.
2016-12-08 4:27 [nfs-utils PATCH 0/10] More support for /etc/nfs.conf NeilBrown
` (2 preceding siblings ...)
2016-12-08 4:27 ` [PATCH 04/10] nfsd: add /etc/nfs.conf support for host= NeilBrown
@ 2016-12-08 4:27 ` NeilBrown
2016-12-08 4:27 ` [PATCH 07/10] xlog: Add common support for "debug=??" in /etc/nfs.conf NeilBrown
` (7 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: NeilBrown @ 2016-12-08 4:27 UTC (permalink / raw)
To: J. Bruce Fields, Steve Dickson; +Cc: linux-nfs
Signed-off-by: NeilBrown <neilb@suse.com>
---
systemd/nfs.conf.man | 5 ++++-
utils/nfsd/nfsd.c | 4 +++-
utils/nfsd/nfsd.man | 3 +++
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
index 03f1f2be534d..23aa4ea7d2f9 100644
--- a/systemd/nfs.conf.man
+++ b/systemd/nfs.conf.man
@@ -104,6 +104,7 @@ for details.
.B nfsd
Recognized values:
.BR threads ,
+.BR port ,
.BR grace-time ,
.BR lease-time ,
.BR udp ,
@@ -120,8 +121,10 @@ Version and protocol values are Boolean values as described above,
and are also used by
.BR rpc.mountd .
Threads and the two times are integers.
+.B port
+and
.B rdma
-is a service name or number. See
+are service names or numbers. See
.BR rpc.nfsd (8)
for details.
diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index d8f873ba3717..7c72bf096d13 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -72,7 +72,6 @@ main(int argc, char **argv)
int lease = -1;
progname = basename(argv[0]);
- port = "nfs";
haddr = xmalloc(sizeof(char *));
haddr[0] = NULL;
@@ -83,6 +82,9 @@ main(int argc, char **argv)
count = conf_get_num("nfsd", "threads", count);
grace = conf_get_num("nfsd", "grace-time", grace);
lease = conf_get_num("nfsd", "lease-time", lease);
+ port = conf_get_str("nfsd", "port");
+ if (!port)
+ port = "nfs";
rdma_port = conf_get_str("nfsd", "rdma");
if (conf_get_bool("nfsd", "udp", NFSCTL_UDPISSET(protobits)))
NFSCTL_UDPSET(protobits);
diff --git a/utils/nfsd/nfsd.man b/utils/nfsd/nfsd.man
index 7b9fbf21a947..bc00464b3517 100644
--- a/utils/nfsd/nfsd.man
+++ b/utils/nfsd/nfsd.man
@@ -131,6 +131,9 @@ The grace time, for both NFSv4 and NLM, in seconds.
.B lease-time
The lease time for NFSv4, in seconds.
.TP
+.B port
+Set the port for TCP/UDP to bind to.
+.TP
.B rdma
Set RDMA port. Use "rdma=nfsrdma" to enable standard port.
.TP
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 04/10] nfsd: add /etc/nfs.conf support for host=
2016-12-08 4:27 [nfs-utils PATCH 0/10] More support for /etc/nfs.conf NeilBrown
2016-12-08 4:27 ` [PATCH 02/10] nfsd: remove pointless memory allocations NeilBrown
2016-12-08 4:27 ` [PATCH 01/10] nfsd: move and improve test on valid port NeilBrown
@ 2016-12-08 4:27 ` NeilBrown
2016-12-08 4:27 ` [PATCH 03/10] nfsd: add /etc/nfs.conf support for nfsd.port option NeilBrown
` (8 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: NeilBrown @ 2016-12-08 4:27 UTC (permalink / raw)
To: J. Bruce Fields, Steve Dickson; +Cc: linux-nfs
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>
---
systemd/nfs.conf.man | 1 +
utils/nfsd/nfsd.c | 15 +++++++++++++++
utils/nfsd/nfsd.man | 7 +++++++
3 files changed, 23 insertions(+)
diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
index 23aa4ea7d2f9..2713bb06c6ed 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 7c72bf096d13..8ee8bf0fe082 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 bc00464b3517..9381cf9d30c3 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
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 05/10] conffile: allow embedded spaces in values.
2016-12-08 4:27 [nfs-utils PATCH 0/10] More support for /etc/nfs.conf NeilBrown
` (5 preceding siblings ...)
2016-12-08 4:27 ` [PATCH 06/10] conffile: fix striping of quotes from values NeilBrown
@ 2016-12-08 4:27 ` NeilBrown
2016-12-08 4:27 ` [PATCH 08/10] exportfs: allow debugging to be enabled in nfs.conf NeilBrown
` (4 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: NeilBrown @ 2016-12-08 4:27 UTC (permalink / raw)
To: J. Bruce Fields, Steve Dickson; +Cc: linux-nfs
The code that said "Skip trailing spaces" actually skipped everything
after the first space.
Change to to only skip trailing spaces, or comments that start after
a space.
This is useful for lists:
Foo: a, b, c
The list handling already allows for internal spaces.
Signed-off-by: NeilBrown <neilb@suse.com>
---
support/nfs/conffile.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
index e4f685c558fa..57f58a2bcdc7 100644
--- a/support/nfs/conffile.c
+++ b/support/nfs/conffile.c
@@ -308,14 +308,18 @@ conf_parse_line(int trans, char *line, size_t sz)
line ++;
j = strcspn(line, "'");
line[j] = 0;
- } else
+ } else {
/* Skip trailing spaces and comments */
for (j = 0; val[j]; j++) {
- if (val[j] == '#' || val[j] == ';' || isspace(val[j])) {
+ if ((val[j] == '#' || val[j] == ';')
+ && (j == 0 || isspace(val[j-1]))) {
val[j] = '\0';
break;
}
}
+ while (j && isspace(val[j-1]))
+ val[--j] = '\0';
+ }
if (strcasecmp(line, "include") == 0)
conf_load(trans, val);
else
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 06/10] conffile: fix striping of quotes from values.
2016-12-08 4:27 [nfs-utils PATCH 0/10] More support for /etc/nfs.conf NeilBrown
` (4 preceding siblings ...)
2016-12-08 4:27 ` [PATCH 07/10] xlog: Add common support for "debug=??" in /etc/nfs.conf NeilBrown
@ 2016-12-08 4:27 ` NeilBrown
2016-12-14 14:33 ` J. Bruce Fields
2016-12-08 4:27 ` [PATCH 05/10] conffile: allow embedded spaces in values NeilBrown
` (5 subsequent siblings)
11 siblings, 1 reply; 14+ messages in thread
From: NeilBrown @ 2016-12-08 4:27 UTC (permalink / raw)
To: J. Bruce Fields, Steve Dickson; +Cc: linux-nfs
There were being stripes from the name instead!
Signed-off-by: NeilBrown <neilb@suse.com>
---
support/nfs/conffile.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
index 57f58a2bcdc7..e717c1e39bab 100644
--- a/support/nfs/conffile.c
+++ b/support/nfs/conffile.c
@@ -300,14 +300,14 @@ conf_parse_line(int trans, char *line, size_t sz)
line[strcspn (line, " \t=")] = '\0';
val = line + i + 1 + strspn (line + i + 1, " \t");
- if (line[0] == '"') {
- line ++;
- j = strcspn(line, "\"");
- line[j] = 0;
- } else if (line[0] == '\'') {
- line ++;
- j = strcspn(line, "'");
- line[j] = 0;
+ if (val[0] == '"') {
+ val ++;
+ j = strcspn(val, "\"");
+ val[j] = 0;
+ } else if (val[0] == '\'') {
+ val ++;
+ j = strcspn(val, "'");
+ val[j] = 0;
} else {
/* Skip trailing spaces and comments */
for (j = 0; val[j]; j++) {
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 07/10] xlog: Add common support for "debug=??" in /etc/nfs.conf
2016-12-08 4:27 [nfs-utils PATCH 0/10] More support for /etc/nfs.conf NeilBrown
` (3 preceding siblings ...)
2016-12-08 4:27 ` [PATCH 03/10] nfsd: add /etc/nfs.conf support for nfsd.port option NeilBrown
@ 2016-12-08 4:27 ` NeilBrown
2016-12-08 4:27 ` [PATCH 06/10] conffile: fix striping of quotes from values NeilBrown
` (6 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: NeilBrown @ 2016-12-08 4:27 UTC (permalink / raw)
To: J. Bruce Fields, Steve Dickson; +Cc: linux-nfs
The value is from the list general, call, auth, parse, all.
Most daemons recognise this in their dedicated section.
Signed-off-by: NeilBrown <neilb@suse.com>
---
support/include/xlog.h | 1 +
support/nfs/xlog.c | 14 ++++++++++++++
systemd/nfs.conf.man | 10 +++++++++-
utils/mountd/mountd.c | 1 +
utils/nfsd/nfsd.c | 1 +
utils/nfsdcltrack/nfsdcltrack.c | 1 +
utils/statd/sm-notify.c | 1 +
utils/statd/statd.c | 1 +
8 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/support/include/xlog.h b/support/include/xlog.h
index 06dc1ab2e8e6..a11463ed8aac 100644
--- a/support/include/xlog.h
+++ b/support/include/xlog.h
@@ -41,6 +41,7 @@ void xlog_stderr(int on);
void xlog_syslog(int on);
void xlog_config(int fac, int on);
void xlog_sconfig(char *, int on);
+void xlog_from_conffile(char *);
int xlog_enabled(int fac);
void xlog(int fac, const char *fmt, ...);
void xlog_warn(const char *fmt, ...);
diff --git a/support/nfs/xlog.c b/support/nfs/xlog.c
index 594ae9b61461..c8e4263408f8 100644
--- a/support/nfs/xlog.c
+++ b/support/nfs/xlog.c
@@ -29,6 +29,7 @@
#include <syslog.h>
#include <errno.h>
#include "nfslib.h"
+#include "conffile.h"
#undef VERBOSE_PRINTF
@@ -125,6 +126,19 @@ xlog_sconfig(char *kind, int on)
xlog_config(tbl->df_fac, on);
}
+void
+xlog_from_conffile(char *service)
+{
+ struct conf_list *kinds;
+ struct conf_list_node *n;
+
+ kinds = conf_get_list(service, "debug");
+ if (!kinds || !kinds->cnt)
+ return;
+ TAILQ_FOREACH(n, &(kinds->fields), link)
+ xlog_sconfig(n->field, 1);
+}
+
int
xlog_enabled(int fac)
{
diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
index 2713bb06c6ed..2de3919a0a80 100644
--- a/systemd/nfs.conf.man
+++ b/systemd/nfs.conf.man
@@ -86,7 +86,15 @@ can be used for "false". Comparisons are case-insensitive.
.SH SECTIONS
The following sections are known to various programs, and can contain
-the given named values.
+the given named values. Most sections can also contain a
+.B debug
+value, which can be one or more from the list
+.BR general ,
+.BR call ,
+.BR auth ,
+.BR parse ,
+.BR all .
+When a list is given, the members should be comma-separated.
.TP
.B nfsdcltrack
Recognized values:
diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
index 2048fce92b8e..5d9466f5c651 100644
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -675,6 +675,7 @@ main(int argc, char **argv)
progname = argv[0];
conf_init();
+ xlog_from_conffile("mountd");
manage_gids = conf_get_bool("mountd", "manage-gids", manage_gids);
descriptors = conf_get_num("mountd", "descriptors", descriptors);
port = conf_get_num("mountd", "port", port);
diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index 8ee8bf0fe082..3c451aa46be1 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -80,6 +80,7 @@ main(int argc, char **argv)
xlog_stderr(1);
conf_init();
+ xlog_from_conffile("nfsd");
count = conf_get_num("nfsd", "threads", count);
grace = conf_get_num("nfsd", "grace-time", grace);
lease = conf_get_num("nfsd", "lease-time", lease);
diff --git a/utils/nfsdcltrack/nfsdcltrack.c b/utils/nfsdcltrack/nfsdcltrack.c
index e6e514b78316..70093bb6dc1a 100644
--- a/utils/nfsdcltrack/nfsdcltrack.c
+++ b/utils/nfsdcltrack/nfsdcltrack.c
@@ -567,6 +567,7 @@ main(int argc, char **argv)
xlog_stderr(0);
conf_init();
+ xlog_from_conffile("nfsdcltrack");
val = conf_get_str("nfsdcltrack", "storagedir");
if (val)
storagedir = val;
diff --git a/utils/statd/sm-notify.c b/utils/statd/sm-notify.c
index 19f40afcb376..623213efcb42 100644
--- a/utils/statd/sm-notify.c
+++ b/utils/statd/sm-notify.c
@@ -490,6 +490,7 @@ main(int argc, char **argv)
progname = argv[0];
conf_init();
+ xlog_from_conffile("sm-notify");
opt_max_retry = conf_get_num("sm-notify", "retry-time", opt_max_retry / 60) * 60;
opt_srcport = conf_get_str("sm-notify", "outgoing-port");
opt_srcaddr = conf_get_str("sm-notify", "outgoing-addr");
diff --git a/utils/statd/statd.c b/utils/statd/statd.c
index 1c34c9ef02cb..d333b2950d88 100644
--- a/utils/statd/statd.c
+++ b/utils/statd/statd.c
@@ -275,6 +275,7 @@ int main (int argc, char **argv)
MY_NAME = NULL;
conf_init();
+ xlog_from_conffile("statd");
out_port = conf_get_num("statd", "outgoing-port", out_port);
port = conf_get_num("statd", "port", port);
MY_NAME = conf_get_str("statd", "name");
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 08/10] exportfs: allow debugging to be enabled in nfs.conf
2016-12-08 4:27 [nfs-utils PATCH 0/10] More support for /etc/nfs.conf NeilBrown
` (6 preceding siblings ...)
2016-12-08 4:27 ` [PATCH 05/10] conffile: allow embedded spaces in values NeilBrown
@ 2016-12-08 4:27 ` NeilBrown
2016-12-08 4:27 ` [PATCH 09/10] gssd: add /etc/nfs.conf support NeilBrown
` (3 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: NeilBrown @ 2016-12-08 4:27 UTC (permalink / raw)
To: J. Bruce Fields, Steve Dickson; +Cc: linux-nfs
Signed-off-by: NeilBrown <neilb@suse.com>
---
systemd/nfs.conf.man | 6 ++++++
utils/exportfs/exportfs.c | 5 +++++
utils/exportfs/exportfs.man | 8 ++++++++
3 files changed, 19 insertions(+)
diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
index 2de3919a0a80..9e427a61d621 100644
--- a/systemd/nfs.conf.man
+++ b/systemd/nfs.conf.man
@@ -189,6 +189,12 @@ See
.BR sm-notify (8)
for details.
+.TP
+.B exportfs
+Only
+.B debug=
+is recognized.
+
.SH FILES
.I /etc/nfs.conf
.SH SEE ALSO
diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
index b7a910efe353..740b79cd8f42 100644
--- a/utils/exportfs/exportfs.c
+++ b/utils/exportfs/exportfs.c
@@ -36,6 +36,7 @@
#include "nfslib.h"
#include "exportfs.h"
#include "xlog.h"
+#include "conffile.h"
static void export_all(int verbose);
static void exportfs(char *arg, char *options, int verbose);
@@ -49,6 +50,7 @@ static void release_lockfile(void);
static const char *lockfile = EXP_LOCKFILE;
static int _lockfd = -1;
+char *conf_path = NFS_CONFFILE;
/*
* If we aren't careful, changes made by exportfs can be lost
@@ -103,6 +105,9 @@ main(int argc, char **argv)
xlog_stderr(1);
xlog_syslog(0);
+ conf_init();
+ xlog_from_conffile("exportfs");
+
while ((c = getopt(argc, argv, "ad:fhio:ruvs")) != EOF) {
switch(c) {
case 'a':
diff --git a/utils/exportfs/exportfs.man b/utils/exportfs/exportfs.man
index fdf9260c6c75..45b6d834ac4a 100644
--- a/utils/exportfs/exportfs.man
+++ b/utils/exportfs/exportfs.man
@@ -90,6 +90,13 @@ to be added to the kernel's export table.
.TP
.B \-d kind " or " \-\-debug kind
Turn on debugging. Valid kinds are: all, auth, call, general and parse.
+Debugging can also be turned on by setting
+.B debug=
+in the
+.B [exportfs]
+section of
+.IR /etc/nfs.conf .
+
.TP
.B -a
Export or unexport all directories.
@@ -295,6 +302,7 @@ master table of exports
table of clients accessing server's exports
.SH SEE ALSO
.BR exports (5),
+.BR nfs.conf (5),
.BR rpc.mountd (8),
.BR netgroup (5)
.SH AUTHORS
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 10/10] svcgssd: add /etc/nfs.conf support
2016-12-08 4:27 [nfs-utils PATCH 0/10] More support for /etc/nfs.conf NeilBrown
` (8 preceding siblings ...)
2016-12-08 4:27 ` [PATCH 09/10] gssd: add /etc/nfs.conf support NeilBrown
@ 2016-12-08 4:27 ` NeilBrown
2016-12-14 14:33 ` [nfs-utils PATCH 0/10] More support for /etc/nfs.conf J. Bruce Fields
2016-12-20 18:44 ` Steve Dickson
11 siblings, 0 replies; 14+ messages in thread
From: NeilBrown @ 2016-12-08 4:27 UTC (permalink / raw)
To: J. Bruce Fields, Steve Dickson; +Cc: linux-nfs
Signed-off-by: NeilBrown <neilb@suse.com>
---
systemd/nfs.conf.man | 9 +++++++++
utils/gssd/svcgssd.c | 14 ++++++++++++++
utils/gssd/svcgssd.man | 17 +++++++++++++++++
3 files changed, 40 insertions(+)
diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
index 938b9705414a..91c49a0f76ab 100644
--- a/systemd/nfs.conf.man
+++ b/systemd/nfs.conf.man
@@ -208,6 +208,15 @@ See
for details.
.TP
+.B svcgssd
+Recognized values:
+.BR principal .
+
+See
+.BR rpc.svcgssd (8)
+for details.
+
+.TP
.B exportfs
Only
.B debug=
diff --git a/utils/gssd/svcgssd.c b/utils/gssd/svcgssd.c
index 0fe7c6ddb686..1fb579aa03f3 100644
--- a/utils/gssd/svcgssd.c
+++ b/utils/gssd/svcgssd.c
@@ -61,6 +61,9 @@
#include "svcgssd.h"
#include "gss_util.h"
#include "err_util.h"
+#include "conffile.h"
+
+char *conf_path = NFS_CONFFILE;
void
sig_die(int signal)
@@ -98,6 +101,17 @@ main(int argc, char *argv[])
extern char *optarg;
char *progname;
char *principal = NULL;
+ char *s;
+
+ conf_init();
+
+ s = conf_get_str("svcgssd", "principal");
+ if (!s)
+ ;
+ else if (strcmp(s, "system")== 0)
+ get_creds = 0;
+ else
+ principal = s;
while ((opt = getopt(argc, argv, "fivrnp:")) != -1) {
switch (opt) {
diff --git a/utils/gssd/svcgssd.man b/utils/gssd/svcgssd.man
index 7b2de6b1ab91..15ef4c94af19 100644
--- a/utils/gssd/svcgssd.man
+++ b/utils/gssd/svcgssd.man
@@ -45,6 +45,23 @@ Use the system default credentials
.RI (host/ FQDN @ REALM )
rather than the default
.RI nfs/ FQDN @ REALM .
+.SH CONFIGURATION FILE
+Some of the options that can be set on the command line can also be
+controlled through values set in the
+.B [svcgssd]
+section of the
+.I /etc/nfs.conf
+configuration file. Values recognized include:
+.TP
+.B principal
+If set to
+.B system
+this is equivalent to the
+.B -n
+option. If set to any other value, that is used like the
+.B -p
+option.
+
.SH SEE ALSO
.BR rpc.gssd(8),
.SH AUTHORS
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 09/10] gssd: add /etc/nfs.conf support
2016-12-08 4:27 [nfs-utils PATCH 0/10] More support for /etc/nfs.conf NeilBrown
` (7 preceding siblings ...)
2016-12-08 4:27 ` [PATCH 08/10] exportfs: allow debugging to be enabled in nfs.conf NeilBrown
@ 2016-12-08 4:27 ` NeilBrown
2016-12-08 4:27 ` [PATCH 10/10] svcgssd: " NeilBrown
` (2 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: NeilBrown @ 2016-12-08 4:27 UTC (permalink / raw)
To: J. Bruce Fields, Steve Dickson; +Cc: linux-nfs
Signed-off-by: NeilBrown <neilb@suse.com>
---
systemd/nfs.conf.man | 18 +++++++++++++++++
utils/gssd/gssd.c | 29 +++++++++++++++++++++++++++
utils/gssd/gssd.man | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 101 insertions(+)
diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
index 9e427a61d621..938b9705414a 100644
--- a/systemd/nfs.conf.man
+++ b/systemd/nfs.conf.man
@@ -190,6 +190,24 @@ See
for details.
.TP
+.B gssd
+Recognized values:
+.BR use-memcache ,
+.BR use-machine-creds ,
+.BR avoid-dns ,
+.BR limit-to-legacy-enctypes ,
+.BR context-timeout ,
+.BR rpc-timeout ,
+.BR pipefs-directory ,
+.BR keytab-file ,
+.BR cred-cache-directory ,
+.BR preferred-realm .
+
+See
+.BR rpc.gssd (8)
+for details.
+
+.TP
.B exportfs
Only
.B debug=
diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
index 3b4d1476c0ad..c65e97cb8fac 100644
--- a/utils/gssd/gssd.c
+++ b/utils/gssd/gssd.c
@@ -71,6 +71,7 @@
#include "gss_util.h"
#include "krb5_util.h"
#include "nfslib.h"
+#include "conffile.h"
static char *pipefs_path = GSSD_PIPEFS_DIR;
static DIR *pipefs_dir;
@@ -78,6 +79,7 @@ static int pipefs_fd;
static int inotify_fd;
struct event inotify_ev;
+char *conf_path = NFS_CONFFILE;
char *keytabfile = GSSD_DEFAULT_KEYTAB_FILE;
char **ccachesearch;
int use_memcache = 0;
@@ -847,6 +849,33 @@ main(int argc, char *argv[])
char *progname;
char *ccachedir = NULL;
struct event sighup_ev;
+ char *s;
+
+ conf_init();
+ use_memcache = conf_get_bool("gssd", "use-memcache", use_memcache);
+ root_uses_machine_creds = conf_get_bool("gssd", "use-machine-creds",
+ root_uses_machine_creds);
+ avoid_dns = conf_get_bool("gssd", "avoid-dns", avoid_dns);
+#ifdef HAVE_SET_ALLOWABLE_ENCTYPES
+ limit_to_legacy_enctypes = conf_get_bool("gssd", "limit-to-legacy-enctypes",
+ limit_to_legacy_enctypes);
+#endif
+ context_timeout = conf_get_num("gssd", "context-timeout", context_timeout);
+ rpc_timeout = conf_get_num("gssd", "rpc-timeout", rpc_timeout);
+ s = conf_get_str("gssd", "pipefs-directory");
+ if (!s)
+ s = conf_get_str("general", "pipefs-directory");
+ if (s)
+ pipefs_path = s;
+ s = conf_get_str("gssd", "keytab-file");
+ if (s)
+ keytablfile = s;
+ s = conf_get_str("gssd", "cred-cache-directory");
+ if (s)
+ ccachedir = s;
+ s = conf_get_str("gssd", "preferred-realm");
+ if (s)
+ preferred_realm = s;
while ((opt = getopt(argc, argv, "DfvrlmnMp:k:d:t:T:R:")) != -1) {
switch (opt) {
diff --git a/utils/gssd/gssd.man b/utils/gssd/gssd.man
index ea58fa0965e8..87eef0249a12 100644
--- a/utils/gssd/gssd.man
+++ b/utils/gssd/gssd.man
@@ -297,6 +297,60 @@ The default timeout is set to 5 seconds.
If you get messages like "WARNING: can't create tcp rpc_clnt to server
%servername% for user with uid %uid%: RPC: Remote system error -
Connection timed out", you should consider an increase of this timeout.
+.SH CONFIGURATION FILE
+Many of the options that can be set on the command line can also be
+controlled through values set in the
+.B [gssd]
+section of the
+.I /etc/nfs.conf
+configuration file. Values recognized include:
+.TP
+.B use-memcache
+A Boolean flag equivalent to
+.BR -M .
+.TP
+.B use-machine-creds
+A Boolean flag. Setting to
+.B false
+is equivalent to giving the
+.B -n
+flag.
+.TP
+.B avoid-dns
+Setting to
+.B false
+is equivalent to providing the
+.B -D
+flag.
+.TP
+.B limit-to-legacy-enctypes
+Equivalent to
+.BR -l .
+.TP
+.B context-timeout
+Equivalent to
+.BR -T .
+.TP
+.B rpc-timeout
+Equivalent to
+.BR -t .
+.TP
+.B pipefs-directory
+Equivalent to
+.BR -p .
+.TP
+.B keytab-file
+Equivalent to
+.BR -k .
+.TP
+.BR cred-cache-directory
+Equivalent to
+.BR -d .
+.TP
+.B preferred-realm
+Equivalent to
+.BR -R .
+
.SH SEE ALSO
.BR rpc.svcgssd (8),
.BR kerberos (1),
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 06/10] conffile: fix striping of quotes from values.
2016-12-08 4:27 ` [PATCH 06/10] conffile: fix striping of quotes from values NeilBrown
@ 2016-12-14 14:33 ` J. Bruce Fields
0 siblings, 0 replies; 14+ messages in thread
From: J. Bruce Fields @ 2016-12-14 14:33 UTC (permalink / raw)
To: NeilBrown; +Cc: J. Bruce Fields, Steve Dickson, linux-nfs
On Thu, Dec 08, 2016 at 03:27:25PM +1100, NeilBrown wrote:
> There were being stripes from the name instead!
s/stripes/stripped/.
>
> Signed-off-by: NeilBrown <neilb@suse.com>
> ---
> support/nfs/conffile.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
> index 57f58a2bcdc7..e717c1e39bab 100644
> --- a/support/nfs/conffile.c
> +++ b/support/nfs/conffile.c
> @@ -300,14 +300,14 @@ conf_parse_line(int trans, char *line, size_t sz)
> line[strcspn (line, " \t=")] = '\0';
> val = line + i + 1 + strspn (line + i + 1, " \t");
>
> - if (line[0] == '"') {
> - line ++;
> - j = strcspn(line, "\"");
> - line[j] = 0;
> - } else if (line[0] == '\'') {
> - line ++;
> - j = strcspn(line, "'");
> - line[j] = 0;
> + if (val[0] == '"') {
> + val ++;
> + j = strcspn(val, "\"");
> + val[j] = 0;
> + } else if (val[0] == '\'') {
> + val ++;
> + j = strcspn(val, "'");
> + val[j] = 0;
> } else {
> /* Skip trailing spaces and comments */
> for (j = 0; val[j]; j++) {
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [nfs-utils PATCH 0/10] More support for /etc/nfs.conf
2016-12-08 4:27 [nfs-utils PATCH 0/10] More support for /etc/nfs.conf NeilBrown
` (9 preceding siblings ...)
2016-12-08 4:27 ` [PATCH 10/10] svcgssd: " NeilBrown
@ 2016-12-14 14:33 ` J. Bruce Fields
2016-12-20 18:44 ` Steve Dickson
11 siblings, 0 replies; 14+ messages in thread
From: J. Bruce Fields @ 2016-12-14 14:33 UTC (permalink / raw)
To: NeilBrown; +Cc: J. Bruce Fields, Steve Dickson, linux-nfs
On Thu, Dec 08, 2016 at 03:27:24PM +1100, NeilBrown wrote:
> Added some missing support for rpc.nfsd, rpc.gss, rpc.svcgssd.
> Fixed a bug.
>
> Added generic support for "debug="
> This only applies to tools which use the xlog() infrastructure.
> blkmapd used syslog directly and gssd has it's own shim. I think
> they should be converted to xlog rather than having separate debug=
> support.
Makes sense to me.--b.
>
> NeilBrown
>
> ---
>
> NeilBrown (10):
> nfsd: move and improve test on valid port
> nfsd: remove pointless memory allocations.
> nfsd: add /etc/nfs.conf support for nfsd.port option.
> nfsd: add /etc/nfs.conf support for host=
> conffile: allow embedded spaces in values.
> conffile: fix striping of quotes from values.
> xlog: Add common support for "debug=??" in /etc/nfs.conf
> exportfs: allow debugging to be enabled in nfs.conf
> gssd: add /etc/nfs.conf support
> svcgssd: add /etc/nfs.conf support
>
>
> support/include/xlog.h | 1 +
> support/nfs/conffile.c | 24 ++++++++++-------
> support/nfs/xlog.c | 14 ++++++++++
> systemd/nfs.conf.man | 49 ++++++++++++++++++++++++++++++++++-
> utils/exportfs/exportfs.c | 5 ++++
> utils/exportfs/exportfs.man | 8 ++++++
> utils/gssd/gssd.c | 29 +++++++++++++++++++++
> utils/gssd/gssd.man | 54 +++++++++++++++++++++++++++++++++++++++
> utils/gssd/svcgssd.c | 14 ++++++++++
> utils/gssd/svcgssd.man | 17 ++++++++++++
> utils/mountd/mountd.c | 1 +
> utils/nfsd/nfsd.c | 48 +++++++++++++++++++++++------------
> utils/nfsd/nfsd.man | 10 +++++++
> utils/nfsdcltrack/nfsdcltrack.c | 1 +
> utils/statd/sm-notify.c | 1 +
> utils/statd/statd.c | 1 +
> 16 files changed, 249 insertions(+), 28 deletions(-)
>
> --
> Signature
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [nfs-utils PATCH 0/10] More support for /etc/nfs.conf
2016-12-08 4:27 [nfs-utils PATCH 0/10] More support for /etc/nfs.conf NeilBrown
` (10 preceding siblings ...)
2016-12-14 14:33 ` [nfs-utils PATCH 0/10] More support for /etc/nfs.conf J. Bruce Fields
@ 2016-12-20 18:44 ` Steve Dickson
11 siblings, 0 replies; 14+ messages in thread
From: Steve Dickson @ 2016-12-20 18:44 UTC (permalink / raw)
To: NeilBrown, J. Bruce Fields; +Cc: linux-nfs
On 12/07/2016 11:27 PM, NeilBrown wrote:
> Added some missing support for rpc.nfsd, rpc.gss, rpc.svcgssd.
> Fixed a bug.
>
> Added generic support for "debug="
> This only applies to tools which use the xlog() infrastructure.
> blkmapd used syslog directly and gssd has it's own shim. I think
> they should be converted to xlog rather than having separate debug=
> support.
>
> NeilBrown
>
> ---
>
> NeilBrown (10):
> nfsd: move and improve test on valid port
> nfsd: remove pointless memory allocations.
> nfsd: add /etc/nfs.conf support for nfsd.port option.
> nfsd: add /etc/nfs.conf support for host=
> conffile: allow embedded spaces in values.
> conffile: fix striping of quotes from values.
> xlog: Add common support for "debug=??" in /etc/nfs.conf
> exportfs: allow debugging to be enabled in nfs.conf
> gssd: add /etc/nfs.conf support
> svcgssd: add /etc/nfs.conf support
All 10 committed....
Note: with these recent changes the API on how
to configure the NFS daemons and tools have changed
drastically.
Technology wise it is a step forward... Distro wise
its a pain in the butt ;-) because bridges have to
be built to maintain backwards compatibility.
With that said, very shortly, I will be posting
a new nfs-utils version (probably nfs-utils-2.1.1).
So if you want something in that not in please
let me know asap..
steved.
>
>
> support/include/xlog.h | 1 +
> support/nfs/conffile.c | 24 ++++++++++-------
> support/nfs/xlog.c | 14 ++++++++++
> systemd/nfs.conf.man | 49 ++++++++++++++++++++++++++++++++++-
> utils/exportfs/exportfs.c | 5 ++++
> utils/exportfs/exportfs.man | 8 ++++++
> utils/gssd/gssd.c | 29 +++++++++++++++++++++
> utils/gssd/gssd.man | 54 +++++++++++++++++++++++++++++++++++++++
> utils/gssd/svcgssd.c | 14 ++++++++++
> utils/gssd/svcgssd.man | 17 ++++++++++++
> utils/mountd/mountd.c | 1 +
> utils/nfsd/nfsd.c | 48 +++++++++++++++++++++++------------
> utils/nfsd/nfsd.man | 10 +++++++
> utils/nfsdcltrack/nfsdcltrack.c | 1 +
> utils/statd/sm-notify.c | 1 +
> utils/statd/statd.c | 1 +
> 16 files changed, 249 insertions(+), 28 deletions(-)
>
> --
> Signature
>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2016-12-20 18:44 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-08 4:27 [nfs-utils PATCH 0/10] More support for /etc/nfs.conf NeilBrown
2016-12-08 4:27 ` [PATCH 02/10] nfsd: remove pointless memory allocations NeilBrown
2016-12-08 4:27 ` [PATCH 01/10] nfsd: move and improve test on valid port NeilBrown
2016-12-08 4:27 ` [PATCH 04/10] nfsd: add /etc/nfs.conf support for host= NeilBrown
2016-12-08 4:27 ` [PATCH 03/10] nfsd: add /etc/nfs.conf support for nfsd.port option NeilBrown
2016-12-08 4:27 ` [PATCH 07/10] xlog: Add common support for "debug=??" in /etc/nfs.conf NeilBrown
2016-12-08 4:27 ` [PATCH 06/10] conffile: fix striping of quotes from values NeilBrown
2016-12-14 14:33 ` J. Bruce Fields
2016-12-08 4:27 ` [PATCH 05/10] conffile: allow embedded spaces in values NeilBrown
2016-12-08 4:27 ` [PATCH 08/10] exportfs: allow debugging to be enabled in nfs.conf NeilBrown
2016-12-08 4:27 ` [PATCH 09/10] gssd: add /etc/nfs.conf support NeilBrown
2016-12-08 4:27 ` [PATCH 10/10] svcgssd: " NeilBrown
2016-12-14 14:33 ` [nfs-utils PATCH 0/10] More support for /etc/nfs.conf J. Bruce Fields
2016-12-20 18:44 ` Steve Dickson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.