From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 0D3595A0275 for ; Wed, 28 Feb 2024 03:30:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1709087408; bh=HX3plkzChLwJAviqCHer9Smr7XfpXwnqvoQI36mmM1I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WQJL7ZYMu/xNF1N3npanDsxix0SbpNh81DLRPco4WhiKD2w1ngpbyKO7bjzjm1JiB AOEvMyUAgqp05ZqHXFuoEWLJ4SmJ/bqfX/te9uJ+8kK98ANrZBZnrQHlZ52HUNgOSh sXGxYCsC81eM4CPHPHz+KTZtA1nluesATdAgQVT3rZ4Q599hbwgTJSAwyARcXkprNz hZHe6MzE8AiJsSllHJI6ohbBNRf6pCz4KqusM55eWOY2sfAQHdlbFhG4cjXrIv8DxV WTmfe/9mLMkxXcjfmzaBeT9lA1YJBU5+pKxoXovADImRtns4w0gvEEIBj1zas7h5zZ zriPoK+Ta31Cw== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4TkyxX4My5z4wcg; Wed, 28 Feb 2024 13:30:08 +1100 (AEDT) Date: Wed, 28 Feb 2024 12:54:19 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 3/7] udp: Unconditionally clear act flag in udp_timer_one() Message-ID: References: <20240221232115.1376333-1-david@gibson.dropbear.id.au> <20240221232115.1376333-4-david@gibson.dropbear.id.au> <20240227125632.6d5a5a3c@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jBYxWbbq7I05f2ai" Content-Disposition: inline In-Reply-To: <20240227125632.6d5a5a3c@elisabeth> Message-ID-Hash: 63KS7A7MBQYO2CDRHFLEAL545YWUGZ27 X-Message-ID-Hash: 63KS7A7MBQYO2CDRHFLEAL545YWUGZ27 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: --jBYxWbbq7I05f2ai Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 27, 2024 at 12:56:32PM +0100, Stefano Brivio wrote: > [Sorry, I wrote this comment a while ago and just now realised I didn't > send this out...] >=20 > On Thu, 22 Feb 2024 10:21:11 +1100 > David Gibson wrote: >=20 > > udp_timer_one() first checks for expiries of various sorts of sockets a= nd > > if necessary sets the 'sockp' variable to trigger a cleanup at the end. > > If sockp is *not* set then, correctly, we don't attempt to close a > > non-existent socket. However, we also don't clear the flag in the > > udp_act[] map, in which case we'll come back here and there will, again= , be > > nothing to be done. >=20 > Well, but that's intended: if we didn't reach UDP_CONN_TIMEOUT for this > port, the socket should still be in udp_act[], meaning we'll check it > against activity timeouts and close on timeout. >=20 > Otherwise, we'll never check that port for the activity timeout, > right? Ah, bother. Yes, my patch is entirely wrong, I'll drop. >=20 > > So, clear the udp_act[] flag, even if we don't need to clean up a socke= t. > >=20 > > Signed-off-by: David Gibson > > --- > > udp.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > >=20 > > diff --git a/udp.c b/udp.c > > index 03a5936e..4200f849 100644 > > --- a/udp.c > > +++ b/udp.c > > @@ -1123,8 +1123,9 @@ static void udp_timer_one(struct ctx *c, int v6, = enum udp_act_type type, > > *sockp =3D -1; > > epoll_ctl(c->epollfd, EPOLL_CTL_DEL, s, NULL); > > close(s); > > - bitmap_clear(udp_act[v6 ? V6 : V4][type], port); > > } > > + > > + bitmap_clear(udp_act[v6 ? V6 : V4][type], port); > > } > > =20 > > /** >=20 --=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 --jBYxWbbq7I05f2ai Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmXekkoACgkQzQJF27ox 2GdCGg/9G2lK5DVtjOg+l4hHcJ9KLN40sgbDfd3q3fBnZFjA74fNtOhittrAH1uf LPeaCg0SAnVKbuEE+PYIa4BSOx61sSENT7eLox71UwgO8rcJRh9TTxcFV/epam4y ZGjwJyjFwpDNzqSwkxTl9vSMkYyosO4VoQ8u5EzfZWkBXu3y2DMIt+4nqFt1/0+h Jatufduhp//x49w9t6BPV1t1M6dv0ehitdrybtSYQDGvCRb4HVKSlxSY/vTRN/8b p5CH+ARY9EyELXlu8oth5um2lotkaY3QiBsor8rL51+QWWo4lk0Xzcl0xCsh06Ih XRACw+1zZKaXV9FnX41Fwdl1AD6LO+p9qz8o/21fkBYXboIdG6xMbMWVfLeKSHhH F/t7x1dX0n9iVCpHHgYgGq/MoIMffBOaGAKWreoNclWRzgh+hTZ+blm/OUZ1/pDC U/siolFSxoz+huWznNzJoGWdd09RYolXvu4LBqNdHH0JR9iPxksE6IHsmERhORNL +0txmWp1voP5BBqh2tQcz0+Av+jNQ30EmxhyR9YPgaxoeQfyhWcYAt8uG8S44scJ H+Xy23itlia5xR1ZJYVD+EBNB6RozQVHuiTPjCPd8O7OvudIGcUXhivAl+H4sUid cfTUan8oRgGSD7Gf+8OkAdDdYeNy6H8xWyxJ8nBy/NMb9+jpU5E= =6t8c -----END PGP SIGNATURE----- --jBYxWbbq7I05f2ai--