Re: [PATCH v4 2/4] meta: Parse 'time' type with timegm()

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

 



On Mon, Jul 01, 2019 at 10:16:44PM +0200, Ander Juaristi wrote:
> Use timegm() to parse the 'time' time. The timegm() function is only
> available on Linux, but overwriting the TZ environment variable seems to
> be a much worse solution.
> 
> The problem is that we need to convert an ISO date to a timestamp
> without taking into account the time zone offset, since comparison will
> be done in kernel space and there is no time zone information there.
> 
> Overwriting TZ is portable, but will cause problems when parsing a
> ruleset that has 'time' and 'hour' rules. Parsing an 'hour' type must
> not do time zone conversion, but that will be automatically done if TZ has
> been overwritten to UTC.
> 
> We could record the initial setting of the
> TZ variable on start, but there's no reliable way to do that (we'd have
> to store the initial TZ in a global variable at program start and re-set
> it every time we parse an 'hour' value).
> 
> Hence it's better idea to use timegm(), even though it's non-portable.
> Netfilter is a Linux program after all.

Please, squash this patch into 1/4 in your next batch. Thanks.



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

  Powered by Linux