[pve-devel] applied: [PATCH firewall] Fix #1492: logger: print timestamps only if we have one
Wolfgang Bumiller
w.bumiller at proxmox.com
Tue Sep 12 14:41:28 CEST 2017
applied...
On Mon, Sep 04, 2017 at 12:43:04PM +0200, Wolfgang Bumiller wrote:
> There's no guarantee that there's a timestamp in an skb, so
> nflog_get_timestamp can fail.
> ---
> Alternatively we could leave out the timestamp entirely in this case,
> but then the gui won't show any timestamps at all in the firewall log
> tab.
>
> src/pvefw-logger.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/pvefw-logger.c b/src/pvefw-logger.c
> index 3dc40eb..12ada77 100644
> --- a/src/pvefw-logger.c
> +++ b/src/pvefw-logger.c
> @@ -753,9 +753,11 @@ static int print_pkt(struct log_entry *le, struct nflog_data *ldata, u_int8_t fa
> LEPRINTF("%s ", chain_name);
>
> struct timeval ts;
> - nflog_get_timestamp(ldata, &ts);
> -
> - LEPRINTTIME(ts.tv_sec);
> + if (nflog_get_timestamp(ldata, &ts) == 0) {
> + LEPRINTTIME(ts.tv_sec);
> + } else {
> + LEPRINTTIME(time(NULL));
> + }
>
> if (prefix != NULL) {
> LEPRINTF("%s", prefix);
> --
> 2.11.0
More information about the pve-devel
mailing list