Re: [nft PATCH 2/2] meta: use reentrant localtime_r()/gmtime_r() functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 22, 2023 at 05:15:14PM +0200, Thomas Haller wrote:
> 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?

Caching this information in the context should be fine, and it might
speed up things for a large batch? How complicate will the update look
like?



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux