From nobody Thu Jul 11 19:40:29 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKlSZ0Nd8z5RJFx; Thu, 11 Jul 2024 19:40:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKlSY71gLz4F94; Thu, 11 Jul 2024 19:40:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720726830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PpbgDKPuLizS8rBrjY+XjuOg8gInJP/lam7DMP8xlGU=; b=tdezjX2O7NfTd6pqBB77mwWqc4Wx04hRqiUma7NUVYAkCfmpcnZm4/+kWK+vWlZs8TFWuh CyeJ0Q8jaTYeAzGaiJyoO6vdPcbAtQ9OX5LHjvvV9eflvChdxks3fvWu4LNBpLIrzTZYik M6zqQ/LyjsYiCufSKyXFWswK2qCVboGY7ZG3o9fe5ywJ1SFljy9DtlGP7PKA6Z8XtQdjr+ SckKLM+GAldvP8jZHQg6fJ1bRTq9+6MOUowSRUA5mn6UMmf7ApbRPqL7qKBrrDbm3dbbOH F452md0a90LSYE9+BM0jwk5kxhAww47ObnNlhJ3mNFTInPvHhjmpe1s9z3Uu1Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720726830; a=rsa-sha256; cv=none; b=ZC2a5ICd5A9XrdC9W50r9fGSm3gZEAjJUlMXq4SUump8RDubMMhB0zs8W2f9Nz4H49O7Et T0VJYzeJJ+UA5HXVJKG5KCPlPIeZzLlGzFQlXjGeKnWWt8q2sk0SbG/uMGpQe/eGljhPNZ o8IHsPQgqsGEawqJsvYnUtQe4q34v5j3PWh8hF8ndFvXck/RCmOCEq4NcblgYHrMRzjSGy KTQp0kO0JlTwr5nd3tbT9sN2CybJhLQeROMD7FV8MeDcDBKxMBstpWk9Q0MmjoMvOSP7mq 3wDDCWLXjKkCikevOjybcgnORlnACFnURrrqsPZWWBaVaEob3C/HC4uCooNUxA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720726830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PpbgDKPuLizS8rBrjY+XjuOg8gInJP/lam7DMP8xlGU=; b=GJ29XahcIdKY8c427MTqiZ6Z2YYDOMFS+Nvo+gyr5pOptKZBT06QyqEkV5gIY+Bhj7ZBba Z7TzQyzRh45KiDQTfPLjBrvzyQeVGrogAKjJ6TcuFG/S6OBnsB4tToMQGfdp60Cyr7OSJO imsnK8lge0Ur2NqkTlUk67ECiT4fREJwOkT3C50uCiLoPhCB7CpCWYE3taL2YoCI4mRghE ++elw1G3LQxC/WeGtP/gck7OHfpk7ganf9GQR8Zc4zxMbUd5qUpZNjun2EIPoJrW0fH5Cv L4CVUOhZCcphhTC9GwAmAwz/6Nr+OXwwqfMV1cdaBAYi45jK6lwkKLhyL3KlMA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WKlSY6VRkz1C7b; Thu, 11 Jul 2024 19:40:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46BJeTCd081072; Thu, 11 Jul 2024 19:40:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46BJeT0u081069; Thu, 11 Jul 2024 19:40:29 GMT (envelope-from git) Date: Thu, 11 Jul 2024 19:40:29 GMT Message-Id: <202407111940.46BJeT0u081069@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 7c2901b08b4e - main - mountd: Add options to disable daemon mode and setting localhost List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7c2901b08b4e68c3fb0587003cf7e46335e24baa Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=7c2901b08b4e68c3fb0587003cf7e46335e24baa commit 7c2901b08b4e68c3fb0587003cf7e46335e24baa Author: Joyu Liao AuthorDate: 2024-07-11 19:38:04 +0000 Commit: Rick Macklem CommitDate: 2024-07-11 19:38:04 +0000 mountd: Add options to disable daemon mode and setting localhost In our products, we need those options to support our features. Add daemon mode option for mountd, nfsd. Add skip local host binding option for rpcd. Add skip local host binding option for mountd. Reviewed by: rmacklem Differential Revision: https://reviews.freebsd.org/D45118 --- usr.sbin/mountd/mountd.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c index 14693a922186..00293909614e 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -287,6 +287,8 @@ static int *sock_fd; static int sock_fdcnt; static int sock_fdpos; static int suspend_nfsd = 0; +static int nofork = 0; +static int skiplocalhost = 0; static int opt_flags; static int have_v6 = 1; @@ -436,7 +438,7 @@ main(int argc, char **argv) else close(s); - while ((c = getopt(argc, argv, "2Adeh:lnp:RrS")) != -1) + while ((c = getopt(argc, argv, "2Adeh:lNnp:RrSs")) != -1) switch (c) { case '2': force_v2 = 1; @@ -495,6 +497,12 @@ main(int argc, char **argv) case 'S': suspend_nfsd = 1; break; + case 'N': + nofork = 1; + break; + case 's': + skiplocalhost = 1; + break; default: usage(); } @@ -514,6 +522,9 @@ main(int argc, char **argv) } } + if (nhosts == 0 && skiplocalhost != 0) + warnx("-s without -h, ignored"); + if (modfind("nfsd") < 0) { /* Not present in kernel, try loading it */ if (kldload("nfsd") < 0 || modfind("nfsd") < 0) @@ -535,7 +546,7 @@ main(int argc, char **argv) get_mountlist(); if (debug) warnx("here we go"); - if (debug == 0) { + if (debug == 0 && nofork == 0) { daemon(0, 0); signal(SIGINT, SIG_IGN); signal(SIGQUIT, SIG_IGN); @@ -571,7 +582,7 @@ main(int argc, char **argv) out_of_mem(); hosts[0] = "*"; nhosts = 1; - } else { + } else if (skiplocalhost == 0) { hosts_bak = hosts; if (have_v6) { hosts_bak = realloc(hosts, (nhosts + 2) * @@ -1111,8 +1122,8 @@ static void usage(void) { fprintf(stderr, - "usage: mountd [-2] [-d] [-e] [-l] [-n] [-p ] [-r] " - "[-S] [-h ] [export_file ...]\n"); + "usage: mountd [-2] [-d] [-e] [-l] [-N] [-n] [-p ] [-r] [-S] " + "[-s] [-h ] [export_file ...]\n"); exit(1); }