From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202502 header.b=QVzLNUZz; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 1FCA75A0777 for ; Mon, 24 Feb 2025 03:21:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202502; t=1740363705; bh=15pT7y8WDD8Quuf5azEuE2D8/PfQzI0dkvsTXd+n2as=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QVzLNUZzAp77/I1Rz+i0vYKReM5Gi5NaChOdY/Sy/wv3Bc0+rjQmtih6hLoNzCbvg BATnnJ7Kl7gQN8JyfcWE6epNwR27NaqKL/SqT7WQgNHE4yI82QhbfOuISzXfXHnY+J t/hMTbCirI+LtDQWxfWY/0RyzSRr/v3gGDdPJ269N5KVL9dI81dCij0cPNf4gNH8L8 hg4zzqf1vTsz+nc2X/BPqqc+MmN7w6ZV+1Btkz3EdEZxFtXDKvg1vCfDvBeL/bdKju hZ0WOF5UnkPT+XtzTpkBysmrEt5Mm1yvIv8ukgUM657TRBkMXlBdcyN7w0Soat1r2Y HJ3VKEt/tSCIA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Z1Pcn3HRgz4wcD; Mon, 24 Feb 2025 13:21:45 +1100 (AEDT) Date: Mon, 24 Feb 2025 13:13:10 +1100 From: David Gibson To: Jon Maloy Subject: Re: [PATCH v5 2/4] udp: create and send ICMPv4 to local peer when applicable Message-ID: References: <20250223225951.3534010-1-jmaloy@redhat.com> <20250223225951.3534010-3-jmaloy@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="CmVXXbxLwrrOlM63" Content-Disposition: inline In-Reply-To: <20250223225951.3534010-3-jmaloy@redhat.com> Message-ID-Hash: DFOHCU322GJHN3IBJ3QZEIOZ4WXSBBJW X-Message-ID-Hash: DFOHCU322GJHN3IBJ3QZEIOZ4WXSBBJW X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top, sbrivio@redhat.com, lvivier@redhat.com, dgibson@redhat.com X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --CmVXXbxLwrrOlM63 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Feb 23, 2025 at 05:59:49PM -0500, Jon Maloy wrote: > When a local peer sends a UDP message to a non-existing port on an > existing remote host, that host will return an ICMP message containing > the error code ICMP_PORT_UNREACH, plus the header and the first eight > bytes of the original message. If the sender socket has been connected, > it uses this message to issue a "Connection Refused" event to the user. >=20 > Until now, we have only read such events from the externally facing > socket, but we don't forward them back to the local sender because > we cannot read the ICMP message directly to user space. Because of > this, the local peer will hang and wait for a response that never > arrives. >=20 > We now fix this for IPv4 by recreating and forwarding a correct ICMP > message back to the internal sender. We synthesize the message based > on the information in the extended error structure, plus the returned > part of the original message body. >=20 > Note that for the sake of completeness, we even produce ICMP messages > for other error codes. We have noticed that at least ICMP_PROT_UNREACH > is propagated as an error event back to the user. >=20 > Signed-off-by: Jon Maloy Reviewed-by: David Gibson With the exception of a formatting nit: > +/** > + * udp_send_conn_fail_icmp4() - Construct and send ICMP to local peer > + * @c: Execution context > + * @ee: Extended error descriptor > + * @ref: epoll reference > + * @in: First bytes (max 8) of original UDP message body > + * @dlen: Length of the read part of original UDP message body Many of these function comments are inconsistent on whether the parameter descriptions are separated by spaces or tabs (it should be tabs). --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --CmVXXbxLwrrOlM63 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAme71bYACgkQzQJF27ox 2GenHw//dLMZTIGpFP6RAB9Ls13X0JMopgMpGpAf08bPVv6Zeh8Aft8px4mnH4qI WKo0u9z0lTYDFMRbKp2eYKJbk+zZqzPXP+WY/FjNLdW1jiHXQOPMVzFvmunI7bzA tAhj+L5LxsyTHhv8cnhKDN88onCLH8Enz2PBJCHAzovaEXmWe6Ubyb77HYwOgc3U UCv6YkgJjFoUHruRjRwdT0WxDaeeqrEfcBwKduTRfr5H6KebHRCE/SkmbR+eSxGS QXaV5fLGO7uZS5lwmeXNTIdyryHPb7dCvQCfcCyOLPKonyRW1VZnYgDlqinwMT/X hlIo6LAQj/+7FsdN2Om5ltIKhXzHFIq48Ga7j8mqJ48dXKIxX95VBC7FB168dHvw 5vge3ujVDB9NARJ2Web2b7w8U2JfLxBHDN3uXBVnVn7JFTpxS99yVDFh9s/ro6RB QzZhhKQInkrgI0sfXC/vyJut5avL/aXbJ/I+0puxxyY2Tbv4HBzRV7q+Uv4Gxxi7 BP/kFvkVRGuYI5e69kId608edGI5n4NHapxnXpw4tpGswmMiSsN9odp2zzC+eree WfvqhijDBi5ZE09FiatEVGBY1DQROJYub2pL25l57MdbeuOLg3GUPnD1BxDeZGw2 gZVSjTEGuHxXRJDnexsGkoGAVf4KFTUOOwxYgpghWLa2RkrSFx8= =zOOU -----END PGP SIGNATURE----- --CmVXXbxLwrrOlM63--