From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 521385A026B for ; Fri, 25 Nov 2022 08:17:23 +0100 (CET) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4NJR5C6Twrz4xN6; Fri, 25 Nov 2022 18:17:19 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1669360639; bh=SS0OSk3jkJ+r8yTJ6ZCtwdM1XRz7n84ZYNr9Hhs5LZw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KZ7RjRsW0j6F0Me/W7XdxAoRDMgTKfK///9z3NRFK4845mfQPzAH7jD1hmqdsAaF9 3pOAv0+3bPAQNWLyS/2rxEvC7tnmJFbAh3Vyy1rHo35EYYVE+hTdx0rzzeDYCoDhCb 2Zt5jl3mWv+j5vTnj3SMsfFZ9So4v6eOO+dZ2P9o= Date: Fri, 25 Nov 2022 18:07:32 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH v2 04/16] udp: Don't connect "forward" sockets for spliced flows Message-ID: References: <20221124011659.1024901-1-david@gibson.dropbear.id.au> <20221124011659.1024901-5-david@gibson.dropbear.id.au> <20221125024759.5405714d@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Z+WzzBmXIlkNQzOY" Content-Disposition: inline In-Reply-To: <20221125024759.5405714d@elisabeth> Message-ID-Hash: 7N35BXTDZFIRCGCVFGDIRF3JBSONR6TU X-Message-ID-Hash: 7N35BXTDZFIRCGCVFGDIRF3JBSONR6TU 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 X-Mailman-Version: 3.3.3 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: --Z+WzzBmXIlkNQzOY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 25, 2022 at 02:47:59AM +0100, Stefano Brivio wrote: > Nit: >=20 > On Thu, 24 Nov 2022 12:16:47 +1100 > David Gibson wrote: >=20 > > Currently we connect() the socket we use to forward spliced UDP flows. > > However, we now only ever use sendto() rather than send() on this socket > > so there's not actually any need to connect it. Don't do so. > >=20 > > Rename a number of things that referred to "connect" or "conn" since th= at > > would now be misleading. > >=20 > > Signed-off-by: David Gibson > > --- > > udp.c | 85 ++++++++++++++++++++++++----------------------------------- > > 1 file changed, 35 insertions(+), 50 deletions(-) > >=20 > > diff --git a/udp.c b/udp.c > > index 1e78da5..ed095ec 100644 > > --- a/udp.c > > +++ b/udp.c > > @@ -45,23 +45,20 @@ > > * > > * - from init to namespace: > > * > > - * - forward direction: 127.0.0.1:5000 -> 127.0.0.1:80 in init from = bound > > - * socket s, with epoll reference: index =3D 80, splice =3D UDP_TO= _NS > > + * - forward direction: 127.0.0.1:5000 -> 127.0.0.1:80 in init from = socket s, > > + * with epoll reference: index =3D 80, splice =3D UDP_TO_NS > > * - if udp_splice_to_ns[V4][5000].target_sock: > > * - send packet to udp_splice_to_ns[V4][5000].target_sock, with > > * destination port 80 > > * - otherwise: > > * - create new socket udp_splice_to_ns[V4][5000].target_sock > > * - bind in namespace to 127.0.0.1:5000 > > - * - connect in namespace to 127.0.0.1:80 (note: this destinatio= n port > > - * might be remapped to another port instead) > > * - add to epoll with reference: index =3D 5000, splice: UDP_BA= CK_TO_INIT > > * - set udp_splice_to_ns[V4][5000].orig_sock to s > > * - update udp_splice_to_ns[V4][5000].ts with current time > > * > > - * - reverse direction: 127.0.0.1:80 -> 127.0.0.1:5000 in namespace = =66rom > > - * connected socket s, having epoll reference: index =3D 5000, > > - * splice =3D UDP_BACK_TO_INIT > > + * - reverse direction: 127.0.0.1:80 -> 127.0.0.1:5000 in namespace = socket s, > > + * having epoll reference: index =3D 5000, splice =3D UDP_BACK_TO_= INIT > > * - if udp_splice_to_ns[V4][5000].orig_sock: > > * - send to udp_splice_to_ns[V4][5000].orig_sock, with destinat= ion port > > * 5000 > > @@ -69,7 +66,7 @@ > > * > > * - from namespace to init: > > * > > - * - forward direction: 127.0.0.1:2000 -> 127.0.0.1:22 in namespace = =66rom bound > > + * - forward direction: 127.0.0.1:2000 -> 127.0.0.1:22 in namespace = =66rom > > * socket s, with epoll reference: index =3D 22, splice =3D UDP_TO= _INIT > > * - if udp4_splice_to_init[V4][2000].target_sock: > > * - send packet to udp_splice_to_init[V4][2000].target_sock, wi= th > > @@ -77,14 +74,12 @@ > > * - otherwise: > > * - create new socket udp_splice_to_init[V4][2000].target_sock > > * - bind in init to 127.0.0.1:2000 > > - * - connect in init to 127.0.0.1:22 (note: this destination port > > - * might be remapped to another port instead) > > * - add to epoll with reference: index =3D 2000, splice =3D UDP= _BACK_TO_NS > > * - set udp_splice_to_init[V4][2000].orig_sock to s > > * - update udp_splice_to_init[V4][2000].ts with current time > > * > > - * - reverse direction: 127.0.0.1:22 -> 127.0.0.1:2000 in init from = connected > > - * socket s, having epoll reference: index =3D 2000, splice =3D UD= P_BACK_TO_NS > > + * - reverse direction: 127.0.0.1:22 -> 127.0.0.1:2000 in init from = socket s, > > + * having epoll reference: index =3D 2000, splice =3D UDP_BACK_TO_= NS > > * - if udp_splice_to_init[V4][2000].orig_sock: > > * - send to udp_splice_to_init[V4][2000].orig_sock, with destinat= ion port > > * 2000 > > @@ -144,8 +139,7 @@ struct udp_tap_port { > > * @orig_sock: Originating socket, bound to dest port in source ns of > > * originating datagram > > * @target_sock: Target socket, bound to source port of originating > > - * datagram in dest ns, connected to dest port of > > - * originating datagram in dest ns > > + * datagram in dest ns > > * @ts: Activity timestamp > > */ > > struct udp_splice_flow { > > @@ -163,8 +157,8 @@ static struct udp_splice_flow udp_splice_to_init[IP= _VERSIONS][NUM_PORTS]; > > =20 > > enum udp_act_type { > > UDP_ACT_TAP, > > - UDP_ACT_NS_CONN, > > - UDP_ACT_INIT_CONN, > > + UDP_ACT_SPLICE_NS, > > + UDP_ACT_SPLICE_INIT, > > UDP_ACT_TYPE_MAX, > > }; > > =20 > > @@ -398,20 +392,19 @@ static void udp_sock6_iov_init(void) > > } > > =20 > > /** > > - * udp_splice_connect() - Create and connect socket for "spliced" bind= ing > > + * udp_splice_new() - Create and prepare socket for "spliced" binding > > * @c: Execution context > > - * @v6: Set for IPv6 connections > > + * @v6: Set for IPv6 sockets > > * @bound_sock: Originating bound socket > > * @src: Source port of original connection, host order > > - * @dst: Destination port of original connection, host order > > * @splice: UDP_BACK_TO_INIT from init, UDP_BACK_TO_NS from namespace > > * > > - * Return: connected socket, negative error code on failure > > + * Return: Prepared socket, negative error code on failure >=20 > prepared Fixed. Is there a particular rationale for capitalizing on the parameters, but not the return description? --=20 David Gibson | 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 --Z+WzzBmXIlkNQzOY Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoULxWu4/Ws0dB+XtgypY4gEwYSIFAmOAaa0ACgkQgypY4gEw YSLY0w//XzB3AHa0U983EjYCfI1aKd8ONLnkFjOjAdMrSUuI3Jo2nIX6LnO1MmZV dgUIZNCPRnnek8/yvYVlA+Ba0yy1aE5Za6dNzB4gHzhbEyVpfSyDvAmK/EeTFhX/ fbpGBQHLhUeovwQrznrDBPxxahkKFZK9U09fN2dosDJSCbBYv3vx+c3ZjCnXBEBI BktOOIYRUi7ePBCQpvpzQ3BSnHiqtCZboZgMCS4gnbd/P67KQGAh0g3NPTx77Y// 7VhYMBPXtadAj8LSMwscYG9Z66Ct5fFyMCTXhGhyHiRXPQroKWNDRkYfVslqmlO0 o2mD43EihSvKsNZV+IIgv9nCfmbIgEqbSPveZG9ZzwuuU0NzRZMj/FXYQkh4ypU0 J2tB8fBZOSeWgwk2P7FvpTaiILAsXG7dY0mQ71A7gnEVAwmjMr4oUM+g8WNJ1wQ0 O27fkMHwiI8wrutB6j7czsrOWrt/A1Hg9fWH1YYCRbkC1dIteBKZ8LI9I95poETb 6wS8+Txdvl0NULKeIpcwJNtm44bXvaYjkX2FbiSmYGMenAp1zb54bP1rG4vJumbu 51MbHUoujX/8K4UrXrfj80W4jggoQLqKuMNRqlmbuxh2o+Vhb4ziyYqQrsrVlsNq gyEyJslsjyfzeZz2DgT/0LLUaPboWXF3odj+lHDeMJBd62gPOQU= =UHGb -----END PGP SIGNATURE----- --Z+WzzBmXIlkNQzOY--