svn commit: r278261 - head/sbin/ipfw

Alexander V. Chernikov melifaro at FreeBSD.org
Thu Feb 5 14:08:34 UTC 2015


Author: melifaro
Date: Thu Feb  5 14:08:33 2015
New Revision: 278261
URL: https://svnweb.freebsd.org/changeset/base/278261

Log:
  Retrieve counters from kernel if rule timstamping is requested.
  
  PR:		kern/197271
  Submitted by:	lev
  Sponsored by:	Yandex LLC

Modified:
  head/sbin/ipfw/ipfw2.c

Modified: head/sbin/ipfw/ipfw2.c
==============================================================================
--- head/sbin/ipfw/ipfw2.c	Thu Feb  5 13:53:31 2015	(r278260)
+++ head/sbin/ipfw/ipfw2.c	Thu Feb  5 14:08:33 2015	(r278261)
@@ -61,6 +61,7 @@ struct format_opts {
 	int bcwidth;
 	int pcwidth;
 	int show_counters;
+	int show_time;		/* show timestamp */
 	uint32_t set_mask;	/* enabled sets mask */
 	uint32_t flags;		/* request flags */
 	uint32_t first;		/* first rule to request */
@@ -2402,7 +2403,7 @@ list_static_range(struct cmdline_opts *c
 	for (n = seen = 0; n < rcnt; n++,
 	    rtlv = (ipfw_obj_tlv *)((caddr_t)rtlv + rtlv->length)) {
 
-		if (fo->show_counters != 0) {
+		if ((fo->show_counters | fo->show_time) != 0) {
 			cntr = (struct ip_fw_bcounter *)(rtlv + 1);
 			r = (struct ip_fw_rule *)((caddr_t)cntr + cntr->size);
 		} else {
@@ -2504,10 +2505,11 @@ ipfw_list(int ac, char *av[], int show_c
 	/* get configuraion from kernel */
 	cfg = NULL;
 	sfo.show_counters = show_counters;
+	sfo.show_time = co.do_time;
 	sfo.flags = IPFW_CFG_GET_STATIC;
 	if (co.do_dynamic != 0)
 		sfo.flags |= IPFW_CFG_GET_STATES;
-	if (sfo.show_counters != 0)
+	if ((sfo.show_counters | sfo.show_time) != 0)
 		sfo.flags |= IPFW_CFG_GET_COUNTERS;
 	if (ipfw_get_config(&co, &sfo, &cfg, &sz) != 0)
 		err(EX_OSERR, "retrieving config failed");


More information about the svn-src-head mailing list