virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: "Cong Wang ." <cong.wang@bytedance.com>
Cc: 段熊春 <duanxiongchun@bytedance.com>,
	"jiang.wang" <jiang.wang@bytedance.com>,
	mst@redhat.com, cohuck@redhat.com,
	virtualization@lists.linux-foundation.org,
	xieyongji@bytedance.com, asias@redhat.com,
	arseny.krasnov@kaspersky.com
Subject: Re: [RFC PATCH] virtio-vsock: add description for datagram type
Date: Mon, 26 Apr 2021 17:07:12 +0100	[thread overview]
Message-ID: <YIblMHI+NplPHIDx@stefanha-x1.localdomain> (raw)
In-Reply-To: <CAA68J_bQHzFXnsLpCqZ3waPW1NGz+hnu2OXfAG4XOLemLOX9DQ@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1773 bytes --]

On Wed, Apr 14, 2021 at 05:43:52PM -0700, Cong Wang . wrote:
> On Wed, Mar 17, 2021 at 8:45 AM Stefan Hajnoczi <stefanha@redhat.com> wrote:
> >
> > Please stick to UDP semantics as much as possible so that applications
> > can be ported easily and developers aren't surprised by unexpected
> > behavior. UDP packets sent to a destination that has no listen socket
> > result in a Connection Refused error. vsock dgrams should behave in the
> > same way.
> 
> There is no connection refused error for UDP, as it is clearly connectionless.
> What you suggested might be an ICMP unreachable error, however, vsock does
> not have anything equivalent. So, I think there is no error returned
> in this scenario
> for vsock datagram.

Yes, exactly. UDP uses ICMP unreachable:

  16:55:40.380292 IP 127.0.0.1.41519 > 127.0.0.1.1234: UDP, length 5
  16:55:40.380308 IP 127.0.0.1 > 127.0.0.1: ICMP 127.0.0.1 udp port 1234 unreachable, length 41

This is mentioned a bit here:
https://tools.ietf.org/html/rfc8085#section-5.2

Here is how Python's socket module produces an ConnectionRefused
exception:

  socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, IPPROTO_IP) = 3
  sendto(3, "hello", 5, 0, {sa_family=AF_INET, sin_port=htons(1234), sin_addr=inet_addr("127.0.0.1")}, 16) = 5
  getsockname(3, {sa_family=AF_INET, sin_port=htons(41519), sin_addr=inet_addr("0.0.0.0")}, [16]) = 0
  getpeername(3, 0x7ffc43c99a20, [16])    = -1 ENOTCONN (Transport endpoint is not connected)

UDP itself may not carry this information but applications do rely on
the ICMP information as shown above.

The Linux network stack implementation is here:
net/ipv4/udp.c:__udp4_lib_err().

Please take a look and decide how vsock dgrams can have similar
semantics.

Stefan

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

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  parent reply	other threads:[~2021-04-26 16:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16 21:56 [RFC PATCH] virtio-vsock: add description for datagram type jiang.wang
2021-03-17 15:44 ` Stefan Hajnoczi
2021-03-18 17:59   ` [External] " Jiang Wang .
2021-03-22 16:50     ` Stefan Hajnoczi
2021-03-22 23:02       ` Jiang Wang .
2021-03-22 23:10         ` Michael S. Tsirkin
2021-03-23  2:23           ` Jiang Wang .
2021-03-23  8:53             ` Stefan Hajnoczi
2021-03-26 23:40               ` Jiang Wang .
2021-03-29  9:25                 ` Stefan Hajnoczi
2021-03-29 23:22                   ` Jiang Wang .
2021-03-30 10:42                     ` Stefan Hajnoczi
2021-03-30 18:30                       ` Jiang Wang .
2021-03-30 15:32                 ` Stefano Garzarella
2021-03-30 18:34                   ` Jiang Wang .
2021-03-31  1:02                     ` Jiang Wang .
2021-03-31  6:42                       ` Stefano Garzarella
     [not found]   ` <CAA68J_bQHzFXnsLpCqZ3waPW1NGz+hnu2OXfAG4XOLemLOX9DQ@mail.gmail.com>
2021-04-26 16:07     ` Stefan Hajnoczi [this message]
     [not found]       ` <CAA68J_Z=1uf5rLCpQeH+m9YmsYGsbJgf2VtRJjQrBd_jTdUYuA@mail.gmail.com>
2021-05-13 16:04         ` 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=YIblMHI+NplPHIDx@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=arseny.krasnov@kaspersky.com \
    --cc=asias@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=cong.wang@bytedance.com \
    --cc=duanxiongchun@bytedance.com \
    --cc=jiang.wang@bytedance.com \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xieyongji@bytedance.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).