aboutsummaryrefslogtreecommitdiff
path: root/sys/netpfil/ipfw/ip_fw_sockopt.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netpfil/ipfw/ip_fw_sockopt.c')
-rw-r--r--sys/netpfil/ipfw/ip_fw_sockopt.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/netpfil/ipfw/ip_fw_sockopt.c b/sys/netpfil/ipfw/ip_fw_sockopt.c
index 4af0fe4bb94b..a62b19e4d3da 100644
--- a/sys/netpfil/ipfw/ip_fw_sockopt.c
+++ b/sys/netpfil/ipfw/ip_fw_sockopt.c
@@ -395,6 +395,7 @@ swap_map(struct ip_fw_chain *chain, struct ip_fw **new_map, int new_len)
static void
export_cntr1_base(struct ip_fw *krule, struct ip_fw_bcounter *cntr)
{
+ struct timeval boottime;
cntr->size = sizeof(*cntr);
@@ -403,21 +404,26 @@ export_cntr1_base(struct ip_fw *krule, struct ip_fw_bcounter *cntr)
cntr->bcnt = counter_u64_fetch(krule->cntr + 1);
cntr->timestamp = krule->timestamp;
}
- if (cntr->timestamp > 0)
+ if (cntr->timestamp > 0) {
+ getboottime(&boottime);
cntr->timestamp += boottime.tv_sec;
+ }
}
static void
export_cntr0_base(struct ip_fw *krule, struct ip_fw_bcounter0 *cntr)
{
+ struct timeval boottime;
if (krule->cntr != NULL) {
cntr->pcnt = counter_u64_fetch(krule->cntr);
cntr->bcnt = counter_u64_fetch(krule->cntr + 1);
cntr->timestamp = krule->timestamp;
}
- if (cntr->timestamp > 0)
+ if (cntr->timestamp > 0) {
+ getboottime(&boottime);
cntr->timestamp += boottime.tv_sec;
+ }
}
/*
@@ -2055,11 +2061,13 @@ ipfw_getrules(struct ip_fw_chain *chain, void *buf, size_t space)
char *ep = bp + space;
struct ip_fw *rule;
struct ip_fw_rule0 *dst;
+ struct timeval boottime;
int error, i, l, warnflag;
time_t boot_seconds;
warnflag = 0;
+ getboottime(&boottime);
boot_seconds = boottime.tv_sec;
for (i = 0; i < chain->n_rules; i++) {
rule = chain->map[i];