Linux NFS development
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@RedHat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, linux-nfs@vger.kernel.org
Cc: Jeff Layton <jlayton@redhat.com>, Abbas Naderi <abiusx@google.com>
Subject: Re: [PATCH nfs-utils v2 10/12] exportfs: add support for "vsock:" exports(5) syntax
Date: Fri, 30 Jun 2017 11:07:27 -0400	[thread overview]
Message-ID: <3d149aad-1bbd-4fef-15fd-7ffd6ab85dd1@RedHat.com> (raw)
In-Reply-To: <20170630132120.31578-11-stefanha@redhat.com>



On 06/30/2017 09:21 AM, Stefan Hajnoczi wrote:
> Allow exports to be restricted to AF_VSOCK clients:
> 
>   # exportfs vsock:3:/export
> 
> and:
> 
>   # cat /etc/exports
>   /export	vsock:*(rw,no_root_squash,insecure,subtree_check)
Again it would be nice to use hostnames or address types
instead of a qualifier like 'vsock'... But if we do end
up going down this road, this definitely has to be
documented in the man page. 

steved.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  utils/exportfs/exportfs.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
> index 3ded733..6bf67f1 100644
> --- a/utils/exportfs/exportfs.c
> +++ b/utils/exportfs/exportfs.c
> @@ -299,6 +299,20 @@ static int exportfs_generic(char *arg, char *options, int verbose)
>  	return 0;
>  }
>  
> +static int exportfs_vsock(char *arg, char *options, int verbose)
> +{
> +	char *path;
> +
> +	if ((path = strchr(arg + strlen("vsock:"), ':')) != NULL)
> +		*path++ = '\0';
> +
> +	if (!path || *path != '/')
> +		return 1;
> +
> +	exportfs_parsed(arg, path, options, verbose);
> +	return 0;
> +}
> +
>  static int exportfs_ipv6(char *arg, char *options, int verbose)
>  {
>  	char *path, *c;
> @@ -332,6 +346,8 @@ exportfs(char *arg, char *options, int verbose)
>  
>  	if (*arg == '[')
>  		failed = exportfs_ipv6(arg, options, verbose);
> +	else if (strncmp(arg, "vsock:", strlen("vsock:")) == 0)
> +		failed = exportfs_vsock(arg, options, verbose);
>  	else
>  		failed = exportfs_generic(arg, options, verbose);
>  	if (failed)
> @@ -412,6 +428,20 @@ static int unexportfs_generic(char *arg, int verbose)
>  	return 0;
>  }
>  
> +static int unexportfs_vsock(char *arg, int verbose)
> +{
> +	char *path;
> +
> +	if ((path = strchr(arg + strlen("vsock:"), ':')) != NULL)
> +		*path++ = '\0';
> +
> +	if (!path || *path != '/')
> +		return 1;
> +
> +	unexportfs_parsed(arg, path, verbose);
> +	return 0;
> +}
> +
>  static int unexportfs_ipv6(char *arg, int verbose)
>  {
>  	char *path, *c;
> @@ -445,6 +475,8 @@ unexportfs(char *arg, int verbose)
>  
>  	if (*arg == '[')
>  		failed = unexportfs_ipv6(arg, verbose);
> +	else if (strncmp(arg, "vsock:", strlen("vsock:")) == 0)
> +		failed = unexportfs_vsock(arg, verbose);
>  	else
>  		failed = unexportfs_generic(arg, verbose);
>  	if (failed)
> 

  reply	other threads:[~2017-06-30 15:07 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30 13:21 [PATCH nfs-utils v2 00/12] add NFS over AF_VSOCK support Stefan Hajnoczi
2017-06-30 13:21 ` [PATCH nfs-utils v2 01/12] mount: don't use IPPROTO_UDP for address resolution Stefan Hajnoczi
2017-06-30 14:34   ` Steve Dickson
2017-07-03  8:55     ` Stefan Hajnoczi
2017-07-03 16:35       ` Steve Dickson
2017-06-30 13:21 ` [PATCH nfs-utils v2 02/12] nfs-utils: add AF_VSOCK support to sockaddr.h Stefan Hajnoczi
2017-06-30 13:21 ` [PATCH nfs-utils v2 03/12] mount: present AF_VSOCK addresses Stefan Hajnoczi
2017-06-30 14:40   ` Steve Dickson
2017-07-03  9:00     ` Stefan Hajnoczi
2017-07-03 16:51       ` Steve Dickson
2017-07-03 21:04         ` Felix Janda
2017-07-10 18:14         ` Stefan Hajnoczi
2017-07-12 14:26           ` Steve Dickson
2017-07-06 17:16       ` J. Bruce Fields
2017-07-10 18:09         ` Stefan Hajnoczi
2017-06-30 13:21 ` [PATCH nfs-utils v2 04/12] mount: accept AF_VSOCK in nfs_verify_family() Stefan Hajnoczi
2017-06-30 13:21 ` [PATCH nfs-utils v2 05/12] getport: recognize "vsock" netid Stefan Hajnoczi
2017-06-30 15:01   ` Steve Dickson
2017-07-10 18:35     ` Stefan Hajnoczi
2017-06-30 15:52   ` Chuck Lever
2017-07-07  3:17     ` NeilBrown
2017-07-07  4:13       ` NeilBrown
2017-07-25 10:05         ` Stefan Hajnoczi
2017-07-27  5:13           ` NeilBrown
2017-07-27 10:58             ` Stefan Hajnoczi
2017-07-27 11:33               ` Jeff Layton
2017-07-27 23:11               ` NeilBrown
2017-08-03 15:24                 ` Stefan Hajnoczi
2017-08-03 21:45                   ` NeilBrown
2017-08-03 23:53                     ` Matt Benjamin
2017-08-04  3:25                       ` NeilBrown
2017-08-04 15:56                     ` Stefan Hajnoczi
2017-08-04 22:35                       ` NeilBrown
2017-08-08 14:07                         ` Stefan Hajnoczi
2017-07-07  4:14       ` Chuck Lever
2017-07-25 12:29       ` Stefan Hajnoczi
2017-07-19 15:11     ` Stefan Hajnoczi
2017-07-19 15:35       ` Jeff Layton
2017-07-19 15:40         ` Chuck Lever
2017-07-19 15:50       ` Chuck Lever
2017-07-28  0:35     ` Matt Benjamin
2017-06-30 13:21 ` [PATCH nfs-utils v2 06/12] mount: AF_VSOCK address parsing Stefan Hajnoczi
2017-06-30 13:21 ` [PATCH nfs-utils v2 07/12] exportfs: introduce host_freeaddrinfo() Stefan Hajnoczi
2017-06-30 13:21 ` [PATCH nfs-utils v2 08/12] exportfs: add AF_VSOCK address parsing and printing Stefan Hajnoczi
2017-06-30 13:21 ` [PATCH nfs-utils v2 09/12] exportfs: add AF_VSOCK support to set_addrlist() Stefan Hajnoczi
2017-06-30 13:21 ` [PATCH nfs-utils v2 10/12] exportfs: add support for "vsock:" exports(5) syntax Stefan Hajnoczi
2017-06-30 15:07   ` Steve Dickson [this message]
2017-06-30 13:21 ` [PATCH nfs-utils v2 11/12] nfsd: add --vsock (-v) option to nfsd Stefan Hajnoczi
2017-06-30 15:25   ` Steve Dickson
2017-07-10 18:39     ` Stefan Hajnoczi
2017-06-30 13:21 ` [PATCH nfs-utils v2 12/12] tests: add "vsock:" exports(5) test case Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3d149aad-1bbd-4fef-15fd-7ffd6ab85dd1@RedHat.com \
    --to=steved@redhat.com \
    --cc=abiusx@google.com \
    --cc=jlayton@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox