From: Wolfgang Bumiller Date: Mon, 4 Sep 2017 08:56:59 +0000 (+0200) Subject: Fix #1492: logger: print timestamps only if we have one X-Git-Url: https://git.proxmox.com/?p=pve-firewall.git;a=commitdiff_plain;h=2388cab121beef58bb20b6b2275379304c6de737 Fix #1492: logger: print timestamps only if we have one There's no guarantee that there's a timestamp in an skb, so nflog_get_timestamp can fail. --- 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);