From owner-freebsd-pf@freebsd.org Fri Apr 14 10:38:35 2017 Return-Path: Delivered-To: freebsd-pf@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7DB6D3C84B for ; Fri, 14 Apr 2017 10:38:35 +0000 (UTC) (envelope-from srs0=jjiy=3w=sigsegv.be=kristof@codepro.be) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 728B23F8 for ; Fri, 14 Apr 2017 10:38:35 +0000 (UTC) (envelope-from srs0=jjiy=3w=sigsegv.be=kristof@codepro.be) Received: from [172.16.5.2] (vega.codepro.be [IPv6:2a01:4f8:162:1127::3]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 4F10A7BC8; Fri, 14 Apr 2017 12:38:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sigsegv.be; s=mail; t=1492166312; bh=ZDg2l+5A9hDDiS7pBLdH0omNqrpJMF4PQTjH0BGZpTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GJ8jN0fdXYhR4WbchfHvIrbOT81LzAoqF6AyVaXOU4TUTCrVzmAuscBSqiEGfTTC5 fnd9MroM5ZrkfcuCRe2RoE8V7jN8KlZb+4Y5pOyD6GA+7T3gnT/CU57fjdP4zYLIlC La0qhqH/6PAe8aNYBVFxpuJfSmunANb9XybagJ70= From: "Kristof Provost" To: Max Cc: freebsd-pf@FreeBSD.org Subject: Re: pfctl does not clear limit couters Date: Fri, 14 Apr 2017 12:38:31 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Mailer: MailMate (2.0BETAr6082) X-BeenThere: freebsd-pf@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Technical discussion and general questions about packet filter \(pf\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Apr 2017 10:38:35 -0000 On 14 Apr 2017, at 8:24, Max wrote: > "pfctl -F info" command doesn't clear limit counters (shown in "pfctl > -vsi" output). > > I think, should be > --- sys/netpfil/pf/pf_ioctl.c.orig 2017-04-14 09:10:25.171380000 > +0300 > +++ sys/netpfil/pf/pf_ioctl.c 2017-04-14 09:13:21.553650000 +0300 > @@ -1835,16 +1835,18 @@ > case DIOCCLRSTATUS: { > PF_RULES_WLOCK(); > for (int i = 0; i < PFRES_MAX; i++) > counter_u64_zero(V_pf_status.counters[i]); > for (int i = 0; i < FCNT_MAX; i++) > counter_u64_zero(V_pf_status.fcounters[i]); > for (int i = 0; i < SCNT_MAX; i++) > counter_u64_zero(V_pf_status.scounters[i]); > + for (int i = 0; i < LCNT_MAX; i++) > + counter_u64_zero(V_pf_status.lcounters[i]); > V_pf_status.since = time_second; > if (*V_pf_status.ifname) > pfi_update_status(V_pf_status.ifname, NULL); > PF_RULES_WUNLOCK(); > break; > } > > case DIOCNATLOOK: { > This looks reasonable, but interestingly OpenBSD also don’t clear lcounters. I’ll dig into it a bit more in the next few days. Regards, Kristof