From 0d90989bef809a846289f8414875c0abe49e7fb6 Mon Sep 17 00:00:00 2001 From: "Alexander V. Chernikov" Date: Sat, 18 Oct 2014 17:23:41 +0000 Subject: [PATCH] Use IPFW_RULE_CNTR_SIZE macro instead of non-relevant ip_fw_cntr structure. Found by: luigi --- sys/netpfil/ipfw/ip_fw_private.h | 8 ++------ sys/netpfil/ipfw/ip_fw_sockopt.c | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/sys/netpfil/ipfw/ip_fw_private.h b/sys/netpfil/ipfw/ip_fw_private.h index bd13ae651580..5da2c0cac7ea 100644 --- a/sys/netpfil/ipfw/ip_fw_private.h +++ b/sys/netpfil/ipfw/ip_fw_private.h @@ -226,12 +226,6 @@ VNET_DECLARE(unsigned int, fw_tables_sets); struct tables_config; #ifdef _KERNEL -typedef struct ip_fw_cntr { - uint64_t pcnt; /* Packet counter */ - uint64_t bcnt; /* Byte counter */ - uint64_t timestamp; /* tv_sec of last match */ -} ip_fw_cntr; - /* * Here we have the structure representing an ipfw rule. * @@ -261,6 +255,8 @@ struct ip_fw { ipfw_insn cmd[1]; /* storage for commands */ }; +#define IPFW_RULE_CNTR_SIZE (2 * sizeof(counter_u64_t)) + #endif struct ip_fw_chain { diff --git a/sys/netpfil/ipfw/ip_fw_sockopt.c b/sys/netpfil/ipfw/ip_fw_sockopt.c index 0c0d022dd8b1..8293c34c2169 100644 --- a/sys/netpfil/ipfw/ip_fw_sockopt.c +++ b/sys/netpfil/ipfw/ip_fw_sockopt.c @@ -162,7 +162,7 @@ ipfw_init_counters() { V_ipfw_cntr_zone = uma_zcreate("IPFW counters", - sizeof(ip_fw_cntr), NULL, NULL, NULL, NULL, + IPFW_RULE_CNTR_SIZE, NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); }