public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Jon Maloy <jmaloy@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>,
	Stefano Brivio <sbrivio@redhat.com>,
	passt-dev@passt.top
Subject: Re: [PATCH 1/2] udp: Don't attempt to forward ICMP socket errors to other sockets
Date: Wed, 26 Mar 2025 18:23:58 -0400	[thread overview]
Message-ID: <b288a0cb-d39b-41a0-ad38-a7496b437e23@redhat.com> (raw)
In-Reply-To: <20250326001501.1866234-2-david@gibson.dropbear.id.au>



On 2025-03-25 20:15, David Gibson wrote:
> Recently we added support for detecting ICMP triggered errors on UDP
> sockets and forwarding them to the tap interface.  However, in
> udp_sock_recverr() where this is handled we don't know for certain that
> the tap interface is the other side of the UDP flow.  It could be a spliced
> connection with another socket on the other side.
> 
> To forward errors in that case, we'd need to force the other side's socket
> to trigger issue an ICMP error.  I'm not sure if there's a way to do that;
> probably not for an arbitrary ICMP but it might be possible for certain
> error conditions.
> 
> Nonetheless what we do now - synthesise an ICMP on the tap interface - is
> certainly wrong.  It's probably harmless; for a spliced connection it will
> have loopback addresses meaning we can expect the guest to discard it.
> But, correct this for now, by not attempting to propagate errors when the
> other side of the flow is a socket.
> 
> Fixes: 55431f007 ("udp: create and send ICMPv4 to local peer when...")
> Fixes: 68b04182e ("udp: create and send ICMPv6 to local peer when...")
> 
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
>   udp.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/udp.c b/udp.c
> index 80520cbd..a706fed9 100644
> --- a/udp.c
> +++ b/udp.c
> @@ -559,7 +559,10 @@ static int udp_sock_recverr(const struct ctx *c, union epoll_ref ref)
>   		const struct flowside *toside = flowside_at_sidx(sidx);
>   		size_t dlen = rc;
>   
> -		if (hdr->cmsg_level == IPPROTO_IP) {
> +		if (pif_is_socket(pif_at_sidx(sidx))) {
> +			/* XXX Is there any way to propagate ICMPs from socket
> +			 * to socket? */
> +		} else if (hdr->cmsg_level == IPPROTO_IP) {
>   			dlen = MIN(dlen, ICMP4_MAX_DLEN);
>   			udp_send_conn_fail_icmp4(c, ee, toside, saddr.sa4.sin_addr,
>   						 data, dlen);

I never thought about this.  I'll try to think of a solution, if there 
even is any.

In the meantime:

Acked-by: Jon Maloy <jmaloy@redhat.com>


  reply	other threads:[~2025-03-26 22:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-26  0:14 [PATCH 0/2] udp: Fix some minor warts in the ICMP error propagation code David Gibson
2025-03-26  0:15 ` [PATCH 1/2] udp: Don't attempt to forward ICMP socket errors to other sockets David Gibson
2025-03-26 22:23   ` Jon Maloy [this message]
2025-03-26  0:15 ` [PATCH 2/2] udp: Improve name of UDP related ICMP sending functions David Gibson
2025-03-26 22:24   ` Jon Maloy
2025-03-26 18:57 ` [PATCH 0/2] udp: Fix some minor warts in the ICMP error propagation code Stefano Brivio

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=b288a0cb-d39b-41a0-ad38-a7496b437e23@redhat.com \
    --to=jmaloy@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@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.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

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 IMAP folder(s).