netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Haller <thaller@redhat.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: NetFilter <netfilter-devel@vger.kernel.org>
Subject: Re: [nft PATCH 2/2] meta: use reentrant localtime_r()/gmtime_r() functions
Date: Tue, 22 Aug 2023 17:15:14 +0200	[thread overview]
Message-ID: <ba3ff8dcecbd37a3e59c30dc26fd4e8fc6734352.camel@redhat.com> (raw)
In-Reply-To: <f5680cd01051242a87f768f5770b062c199971b1.camel@redhat.com>

On Tue, 2023-08-22 at 13:39 +0200, Thomas Haller wrote:
> On Tue, 2023-08-22 at 10:54 +0200, Pablo Neira Ayuso wrote:
> 
> 
> nftables calls localtime_r() from print/parse functions. Presumably,
> we
> will print/parse several timestamps during a larger operation, it
> would
> be odd to change/reload the timezone in between or to meaningfully
> support that.
> 
> 
> I think it is all good, nothing to change. Just to be aware of.
> 

Thinking some more, the "problem" is that when we parse a larger data,
then multiple subfields are parsed. Thereby we call "time()" and
"localtime()" multiple times. The time() keeps ticking, and time and tz
can be reset at any moment -- so we see different time/tz, in the
middle of parsing the larger set of data.

What IMO should happen, is that for one parse operation, we call such
operations at most once, and cache them in `struct netlink_parse_ctx`.


Is that considered a problem to be solved? Seems simple. Would you
accept a patch for that?


Thomas


  reply	other threads:[~2023-08-22 15:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-22  8:13 [nft PATCH 1/2] meta: don't assume time_t is 64 bit in date_type_print() Thomas Haller
2023-08-22  8:13 ` [nft PATCH 2/2] meta: use reentrant localtime_r()/gmtime_r() functions Thomas Haller
2023-08-22  8:54   ` Pablo Neira Ayuso
2023-08-22 11:39     ` Thomas Haller
2023-08-22 15:15       ` Thomas Haller [this message]
2023-08-22 16:06         ` Pablo Neira Ayuso
2023-08-22 16:04       ` Pablo Neira Ayuso
2023-08-22  8:54 ` [nft PATCH 1/2] meta: don't assume time_t is 64 bit in date_type_print() Pablo Neira Ayuso
2023-08-22  9:06 ` Pablo Neira Ayuso

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=ba3ff8dcecbd37a3e59c30dc26fd4e8fc6734352.camel@redhat.com \
    --to=thaller@redhat.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /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.
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 NNTP newsgroup(s).