linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Jeff Layton <jlayton@redhat.com>
Cc: linux-nfs@vger.kernel.org,
	Anna Schumaker <anna.schumaker@netapp.com>,
	"J. Bruce Fields" <bfields@fieldses.org>,
	Trond Myklebust <trond.myklebust@primarydata.com>
Subject: Re: [PATCH v2 01/10] SUNRPC: add AF_VSOCK support to addr.[ch]
Date: Tue, 23 May 2017 14:11:05 +0100	[thread overview]
Message-ID: <20170523131105.GA17369@stefanha-x1.localdomain> (raw)
In-Reply-To: <1495457696.2816.2.camel@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2203 bytes --]

On Mon, May 22, 2017 at 08:54:56AM -0400, Jeff Layton wrote:
> On Mon, 2017-05-22 at 13:21 +0100, Stefan Hajnoczi wrote:
> > On Thu, May 18, 2017 at 10:04:24AM -0400, Jeff Layton wrote:
> > > On Fri, 2016-10-07 at 11:01 +0100, Stefan Hajnoczi wrote:
> > > > @@ -249,6 +302,10 @@ size_t rpc_pton(struct net *net, const char *buf, const size_t buflen,
> > > >  {
> > > >  	unsigned int i;
> > > >  
> > > > +	/* TODO is there a nicer way to distinguish vsock addresses? */
> > > > +	if (strncmp(buf, "vsock:", 6) == 0)
> > > > +		return rpc_pton_vsock(buf, buflen, sap, salen);
> > > > +
> > > 
> > > Ick, what if I have a host on the network named "vsock"? I think you'll
> > > need to come up with a different way to do this.
> > 
> > There is no collision.  This function doesn't do name resolution and no
> > valid IPv4/IPv6 address starts with "vsock:".
> > 
> 
> Doh! Of course... :)
> 
> > I am open to suggestions for a cleaner way of doing it though :).
> 
> Does lsof recognize vsock sockets? How does it format them?

lsof only prints a generic socket representation:

COMMAND     PID   TID       USER   FD      TYPE             DEVICE  SIZE/OFF       NODE NAME
nc-vsock  20775         stefanha    3u     sock                0,9       0t0    1518648 protocol: AF_VSOCK

Depending on a program's command-line syntax, addresses are usually
written as CID:PORT, or vsock:CID:PORT if the program must differentiate
between address types from the string itself.

QEMU, qemu-guest-agent, and systemd have syntax for specifying AF_VSOCK
sockets.  For example:
https://github.com/systemd/systemd/blob/master/src/test/test-socket-util.c#L98

If I have time to submit lsof patches I'll propose the following syntax
(a combination of how AF_UNIX and AF_INET TCP sockets are formatted):

COMMAND     PID   TID       USER   FD      TYPE             DEVICE  SIZE/OFF       NODE NAME
nc-vsock  20775         stefanha    3u     vsock           1520136       0t0    1520136 local=2:1234 state=LISTEN type=STREAM
nc-vsock  20775         stefanha    4u     vsock           1520138       0t0    1520138 local=2:1234 remote=3:51213 state=CONNECTED type=STREAM

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  reply	other threads:[~2017-05-23 13:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-07 10:01 [PATCH v2 00/10] NFS: add AF_VSOCK support to NFS client Stefan Hajnoczi
2016-10-07 10:01 ` [PATCH v2 01/10] SUNRPC: add AF_VSOCK support to addr.[ch] Stefan Hajnoczi
2016-10-07 15:15   ` Chuck Lever
2016-10-21 13:04     ` Stefan Hajnoczi
2016-10-21 14:22       ` Chuck Lever
2017-05-18 14:04   ` Jeff Layton
2017-05-22 12:21     ` Stefan Hajnoczi
2017-05-22 12:54       ` Jeff Layton
2017-05-23 13:11         ` Stefan Hajnoczi [this message]
2016-10-07 10:01 ` [PATCH v2 02/10] SUNRPC: rename "TCP" record parser to "stream" parser Stefan Hajnoczi
2016-10-07 10:01 ` [PATCH v2 03/10] SUNRPC: abstract tcp_read_sock() in record fragment parser Stefan Hajnoczi
2016-10-07 10:01 ` [PATCH v2 04/10] SUNRPC: extract xs_stream_reset_state() Stefan Hajnoczi
2016-10-07 10:01 ` [PATCH v2 05/10] VSOCK: add tcp_read_sock()-like vsock_read_sock() function Stefan Hajnoczi
2016-10-07 10:01 ` [PATCH v2 06/10] SUNRPC: add AF_VSOCK support to xprtsock.c Stefan Hajnoczi
2016-10-07 10:01 ` [PATCH v2 07/10] SUNRPC: drop unnecessary svc_bc_tcp_create() helper Stefan Hajnoczi
2016-10-07 10:01 ` [PATCH v2 08/10] SUNRPC: add AF_VSOCK support to svc_xprt.c Stefan Hajnoczi
2016-10-07 10:01 ` [PATCH v2 09/10] SUNRPC: add AF_VSOCK backchannel support Stefan Hajnoczi
2016-10-07 10:01 ` [PATCH v2 10/10] NFS: add AF_VSOCK support to NFS client Stefan Hajnoczi
2016-10-08  0:42 ` [PATCH v2 00/10] " Cedric Blancher
2016-10-20 14:36   ` Stefan Hajnoczi
2016-10-27  1:05     ` Cedric Blancher
2016-11-30 10:21       ` 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=20170523131105.GA17369@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=anna.schumaker@netapp.com \
    --cc=bfields@fieldses.org \
    --cc=jlayton@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@primarydata.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;
as well as URLs for NNTP newsgroup(s).