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=202512 header.b=ty0ZxxpJ; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 506E55A065B for ; Sat, 20 Dec 2025 10:43:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202512; t=1766223824; bh=WcajtLq2g/VWIzbt5AsiteF0YSt1tw/jl3dGIneT5d4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ty0ZxxpJC0zsaDnVy3SSYTFNm7KHVV9aUqNt3EErOUNnID3SSK3QszETQ9s5AWaLE xjGj5OIE2VWmNtdDd3xmKRNGGQAKZtDhr3GKj7LeAD2/05EWEcD2NBYiHep67fqXiP OYXnIC4bEiSn6wNgnG3xaJ/TUB2ZdUjjF6LwUkFGUe8DDaq96gkLHsUu3wZfM5wdkI qWoKtmXV9i65lZTuACs9IV1AAiZe3640Q3dT3/MMGct/vD9t9TeR2IPI1bxbhWA3Af oM/I0eQDAhLKj+8Fa6R4VBk1Px+gyKngiXDBnI0GsvK1j1TLWlycpMwgdUVY1xMyqX rMNE/JzUFaXng== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4dYKGm0tQMz4wCk; Sat, 20 Dec 2025 20:43:44 +1100 (AEDT) Date: Sat, 20 Dec 2025 20:43:35 +1100 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH 2/7] udp_flow: Assign socket to flow inside udp_flow_sock() Message-ID: References: <20251219164518.930012-1-lvivier@redhat.com> <20251219164518.930012-3-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Dz8AumGnW5sslUqI" Content-Disposition: inline In-Reply-To: <20251219164518.930012-3-lvivier@redhat.com> Message-ID-Hash: 7TAWSKZPUZWCVDZOOPFXKL3QCJDJXDC3 X-Message-ID-Hash: 7TAWSKZPUZWCVDZOOPFXKL3QCJDJXDC3 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.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: --Dz8AumGnW5sslUqI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 19, 2025 at 05:45:13PM +0100, Laurent Vivier wrote: > Move the assignment of uflow->s[sidei] from the caller (udp_flow_new()) > into udp_flow_sock() itself, placing it after the successful connect(). >=20 > This is a pure refactoring with no functional change. The socket fd is > now assigned within udp_flow_sock() where the socket is created, rather > than requiring the caller to capture the return value. On error paths, > uflow->s[sidei] remains at its initialized value of -1 rather than being > set to the negative error code, which is semantically cleaner (though > functionally equivalent given the >=3D 0 check in udp_flow_close()). >=20 > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson > --- > udp_flow.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/udp_flow.c b/udp_flow.c > index 8907f2f72741..33f29f21e69e 100644 > --- a/udp_flow.c > +++ b/udp_flow.c > @@ -109,6 +109,7 @@ static int udp_flow_sock(const struct ctx *c, > flow_dbg_perror(uflow, "Couldn't connect flow socket"); > return rc; > } > + uflow->s[sidei] =3D s; > =20 > /* It's possible, if unlikely, that we could receive some packets in > * between the bind() and connect() which may or may not be for this > @@ -163,7 +164,7 @@ static flow_sidx_t udp_flow_new(const struct ctx *c, = union flow *flow, > =20 > flow_foreach_sidei(sidei) { > if (pif_is_socket(uflow->f.pif[sidei])) > - if ((uflow->s[sidei] =3D udp_flow_sock(c, uflow, sidei)) < 0) > + if (udp_flow_sock(c, uflow, sidei) < 0) > goto cancel; > } > =20 > --=20 > 2.51.1 >=20 --=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 --Dz8AumGnW5sslUqI Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmlGb78ACgkQzQJF27ox 2GenzBAAkriG5Xhl/5BwYHnNAFlfxJpCdyRNAbepnKkMEeI9A5qdnhHRedhb+YBy 15iLh24QZvW0BveRxJLvLcm4l1QOTnhlxVRg50KM2zCBNf4wcCQBh6xd1dkk+mBA zGprQeToL7TQruBaVkMaF7D8l6OD/Mni/SKRCCD8f86EbNNo/cGwtMUzob0Hvx1Y u8Ey3ayZR8gl4ek/b13+jOztX+8mRZVe/pcgTMzMSCq/EaOq2tGEZPHSl3ETjnz4 pkoma0KWtskf0rHgSFBzREA3VrNGLoS/HPJvjlepMKqK8I3zkm4o7dANGzr32t5D BROCoGRdANT7vMDH4X4dff5Uv4XA1IQMA4+k51Ik3+qvMnMmYHRiRnfcoIBqo20r Uw++l4ytkHlvpqRvXJ0Lt8csHg2Ln8Bcsb10wVsNuHjM3yMNBJMqz3W8arLETuO8 Ha04FtDHL2i1XwJ986nOjqJoVHw8oqu/nLW4gV3bm5vCgYGX45yVWpOu2gBnMrKl a1e7noHKQD7bt2kK9y7Wf/pkOGVshHf6SVxqbKzB2h2iKRfF2HimucdMsnAXnL1y U/i9MrPU4j+h4nL9GGK8LWJp7EWqA01miHs/1VQ7FzbHUgdlvldR7vu10RbwMO1b caUiclHVbAggk1LsSfuBiUJh9v60qkCrcZRULYeQ6OZGtCA//jw= =mC2H -----END PGP SIGNATURE----- --Dz8AumGnW5sslUqI--