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 5DA1B5A027D for ; Thu, 22 Feb 2024 00:21:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1708557678; bh=0aBvCTok7CJFglqzCgcxWtoCEruh+Js+OkzFdefn9Ww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nQruZ+iZJcwVfcrOzYCCa5C0Z6w06p+SDo2VSWrs94IGngDRPDB2qvkk/Lf7ohck9 wzVuvbCbjvMp9ReuXZygXetchutUrrwhQh8jfmHylk6G09F+ayB1/shDaYTjVrrOqw k4glWPCsH5pKwQukXWGDZkTOrBntv31QNMklWvXqu8+GYew3RelDWgcGjkyZH4vJ4d di39gu4TLQe1MZ3dYjJe4bslFJBYSH6isWdW7YDfRsASRDWr+L+2K9g4RS1MjoOJ0N n8ukLAGHqxOZO1PthW5N/kS68xKrGjKy8I+DZ05xsIL6a4grAkGGEC24PG1f4FjcrU W8d4JZ2B4865Q== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4TgC2Q2K7gz4wyj; Thu, 22 Feb 2024 10:21:18 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH 3/7] udp: Unconditionally clear act flag in udp_timer_one() Date: Thu, 22 Feb 2024 10:21:11 +1100 Message-ID: <20240221232115.1376333-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240221232115.1376333-1-david@gibson.dropbear.id.au> References: <20240221232115.1376333-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: CDQQDDK22K5SOD5BOLFNANZA5JR2BMWU X-Message-ID-Hash: CDQQDDK22K5SOD5BOLFNANZA5JR2BMWU 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: David Gibson 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: udp_timer_one() first checks for expiries of various sorts of sockets and 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. So, clear the udp_act[] flag, even if we don't need to clean up a socket. Signed-off-by: David Gibson --- udp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 = -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); } /** -- 2.43.2