public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: passt-dev@passt.top
Subject: Re: [PATCH 3/7] udp: Unconditionally clear act flag in udp_timer_one()
Date: Tue, 27 Feb 2024 12:56:32 +0100	[thread overview]
Message-ID: <20240227125632.6d5a5a3c@elisabeth> (raw)
In-Reply-To: <20240221232115.1376333-4-david@gibson.dropbear.id.au>

[Sorry, I wrote this comment a while ago and just now realised I didn't
send this out...]

On Thu, 22 Feb 2024 10:21:11 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:

> 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.

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.

Otherwise, we'll never check that port for the activity timeout, right?

> So, clear the udp_act[] flag, even if we don't need to clean up a socket.
> 
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
>  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);
>  }
>  
>  /**

-- 
Stefano


  reply	other threads:[~2024-02-27 11:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21 23:21 [PATCH 0/7] Assorted small fixes for UDP David Gibson
2024-02-21 23:21 ` [PATCH 1/7] udp: Don't attempt to translate a 0.0.0.0 source address David Gibson
2024-02-22 17:46   ` Stefano Brivio
2024-02-23  4:03     ` David Gibson
2024-02-21 23:21 ` [PATCH 2/7] udp: Set pif in epoll reference for ephemeral host sockets David Gibson
2024-02-21 23:21 ` [PATCH 3/7] udp: Unconditionally clear act flag in udp_timer_one() David Gibson
2024-02-27 11:56   ` Stefano Brivio [this message]
2024-02-28  1:54     ` David Gibson
2024-02-21 23:21 ` [PATCH 4/7] udp: Separate bound sockets from flags David Gibson
2024-02-27 11:56   ` Stefano Brivio
2024-02-28  2:30     ` David Gibson
2024-02-28  3:53       ` David Gibson
2024-02-21 23:21 ` [PATCH 5/7] udp: Small streamline to udp_update_hdr4() David Gibson
2024-02-21 23:21 ` [PATCH 6/7] udp: Fix incorrect usage of IPv6 state in IPv4 path David Gibson
2024-02-21 23:21 ` [PATCH 7/7] udp: Remove unnecessary test for unspecified addr_out David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240227125632.6d5a5a3c@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).