From patchwork Thu Dec 8 04:27:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 9465763 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9469A60459 for ; Thu, 8 Dec 2016 04:28:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B92E2852C for ; Thu, 8 Dec 2016 04:28:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7073928549; Thu, 8 Dec 2016 04:28:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FBB12852C for ; Thu, 8 Dec 2016 04:28:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752956AbcLHE2L (ORCPT ); Wed, 7 Dec 2016 23:28:11 -0500 Received: from mx2.suse.de ([195.135.220.15]:43967 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752876AbcLHE2L (ORCPT ); Wed, 7 Dec 2016 23:28:11 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C8E8FAAC8; Thu, 8 Dec 2016 04:28:09 +0000 (UTC) From: NeilBrown To: "J. Bruce Fields" , Steve Dickson Date: Thu, 08 Dec 2016 15:27:25 +1100 Subject: [PATCH 04/10] nfsd: add /etc/nfs.conf support for host= Cc: linux-nfs@vger.kernel.org Message-ID: <148117124502.31271.12007658221918580352.stgit@noble> In-Reply-To: <148117122602.31271.13586847542442809540.stgit@noble> References: <148117122602.31271.13586847542442809540.stgit@noble> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- systemd/nfs.conf.man | 1 + utils/nfsd/nfsd.c | 15 +++++++++++++++ utils/nfsd/nfsd.man | 7 +++++++ 3 files changed, 23 insertions(+) -- 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 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