I noticed I was getting different results when comparing nfsdctl's config file handling versus rpc.nfsd's. First, the vers4 config option was being treated as a mask, e.g. if vers4=n and vers4.2=y then end result was still that all minorversions were disabled. Change it so that vers4=n would initially toggle off all minorversions, but individual v4.x=y would turn that minorversion back on. Second, don't make assumptions about what default should be passed to conf_get_bool. Instead, test both possible values and only update the nfsd_versions array if an option was explicitly specified. Signed-off-by: Scott Mayhew <smayhew@xxxxxxxxxx> --- utils/nfsdctl/nfsdctl.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/utils/nfsdctl/nfsdctl.c b/utils/nfsdctl/nfsdctl.c index 38c22225..49de55ab 100644 --- a/utils/nfsdctl/nfsdctl.c +++ b/utils/nfsdctl/nfsdctl.c @@ -1305,13 +1305,34 @@ read_nfsd_conf(void) static void configure_versions(void) { - bool v4 = conf_get_bool("nfsd", "vers4", true); + int i, j, max_minor; + char tag[20]; + + max_minor = get_max_minorversion(); + + for (i = 2; i <= 4; ++i) { + sprintf(tag, "vers%d", i); + if (!conf_get_bool("nfsd", tag, true)) { + update_nfsd_version(i, 0, false); + if (i == 4) + for (j = 0; j <= max_minor; ++j) + update_nfsd_version(4, j, false); + } + if (conf_get_bool("nfsd", tag, false)) { + update_nfsd_version(i, 0, true); + if (i == 4) + for (j = 0; j <= max_minor; ++j) + update_nfsd_version(4, j, true); + } + } - update_nfsd_version(2, 0, conf_get_bool("nfsd", "vers2", false)); - update_nfsd_version(3, 0, conf_get_bool("nfsd", "vers3", true)); - update_nfsd_version(4, 0, v4 && conf_get_bool("nfsd", "vers4.0", true)); - update_nfsd_version(4, 1, v4 && conf_get_bool("nfsd", "vers4.1", true)); - update_nfsd_version(4, 2, v4 && conf_get_bool("nfsd", "vers4.2", true)); + for (i = 0; i <= max_minor; ++i) { + sprintf(tag, "vers4.%d", i); + if (!conf_get_bool("nfsd", tag, true)) + update_nfsd_version(4, i, false); + if (conf_get_bool("nfsd", tag, false)) + update_nfsd_version(4, i, true); + } } static void configure_listeners(void) -- 2.45.2