https://redmine.pfsense.org/https://redmine.pfsense.org/favicon.ico?16780521162017-01-17T21:57:26ZpfSense bugtrackerpfSense - Bug #7075: firewall states show negative value for total bytes processedhttps://redmine.pfsense.org/issues/7075?journal_id=307002017-01-17T21:57:26ZMatt Perry
<ul></ul><p>I'm also seeing this problem in the latest release.</p>
<p>2.3.2-RELEASE-p1 (i386)<br />built on Tue Sep 27 12:13:32 CDT 2016<br />FreeBSD 10.3-RELEASE-p9</p> pfSense - Bug #7075: firewall states show negative value for total bytes processedhttps://redmine.pfsense.org/issues/7075?journal_id=307422017-01-19T09:06:50ZPhillip Davisphil@jankaritech.com
<ul></ul><p>These are both 32-bit installs (i386). So MAXINT will be int(2147483647) (2 gig). The numbers are returned by:<br />$rulescnt = pfSense_get_pf_rules();</p>
<p>Certainly $rulescnt array entries are going to wrap around at MAXINT. Maybe pfSense_get_pf_rules() on a 32-bit system will already have wrapped the number around anyway, even before trying to stuff them into PHP vars.</p>
<p>i386 is going away, but the SG-1000 is a 32-bit ARM device. I wonder if PHP on that hardware has the same MAXINT, or if does tricky enough stuff to keep track of overflow and effectively manage int up to 64-bit?</p> pfSense - Bug #7075: firewall states show negative value for total bytes processedhttps://redmine.pfsense.org/issues/7075?journal_id=307682017-01-19T17:55:36ZMatt Perry
<ul></ul><p>This isn't a PHP problem. pfSense_get_pf_rules() is a PHP function written in C as part of php56-pfSense-module. It can be seen at <a class="external" href="https://github.com/pfsense/FreeBSD-ports/blob/devel/devel/php56-pfSense-module/files/pfSense.c#L3012-L3050">https://github.com/pfsense/FreeBSD-ports/blob/devel/devel/php56-pfSense-module/files/pfSense.c#L3012-L3050</a></p>
<p>I'm not much of a C hacker, but maybe it would help if those casts to long were unsigned, or cast to long long.</p> pfSense - Bug #7075: firewall states show negative value for total bytes processedhttps://redmine.pfsense.org/issues/7075?journal_id=307702017-01-19T22:23:36ZPhillip Davisphil@jankaritech.com
<ul></ul><p>Yes, that is true. It depends on what "long" does in the environment in which the C is compiled. When compiled in the 64-bit image maybe it is a 64-bit integer, and maybe add_assoc_long() does the correct thing to transfer a 64-bit binary integer value into a PHP array value.</p>
<p>If it is made longlong in the C, then add_assoc_long() has to work with it (is there an add_assoc_longlong()?) and then what will happen on a 32-bit system that has C support for 64-bit integers (i.e. manipulating them as 2 pieces and sorting out the carries...) but the PHP on that 32-bit system still only supports 32-bit MAXINT. And the underlying pf needs to also use longlong underneath when accumulating the counter...</p> pfSense - Bug #7075: firewall states show negative value for total bytes processedhttps://redmine.pfsense.org/issues/7075?journal_id=308032017-01-22T10:06:25ZLuiz Souzaluiz@netgate.com
<ul><li><strong>Assignee</strong> set to <i>Luiz Souza</i></li></ul> pfSense - Bug #7075: firewall states show negative value for total bytes processedhttps://redmine.pfsense.org/issues/7075?journal_id=308902017-01-25T14:40:10ZLuiz Souzaluiz@netgate.com
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Feedback</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>Should be fixed now: <a class="external" href="https://github.com/pfsense/FreeBSD-ports/commit/2f5f4b5ac53ead4c12761273a3cc332b08806e26">https://github.com/pfsense/FreeBSD-ports/commit/2f5f4b5ac53ead4c12761273a3cc332b08806e26</a></p>
<p>Unfortunately PHP does not have a native 64 bit integer type, there is long and then float/double (not even long long).</p> pfSense - Bug #7075: firewall states show negative value for total bytes processedhttps://redmine.pfsense.org/issues/7075?journal_id=309022017-01-26T05:05:11ZRenato Botelhorenato@netgate.com
<ul><li><strong>Target version</strong> set to <i>2.4.0</i></li></ul> pfSense - Bug #7075: firewall states show negative value for total bytes processedhttps://redmine.pfsense.org/issues/7075?journal_id=324162017-04-01T20:14:21ZAnonymous
<ul></ul><p>Can not duplicate this behavior in 2.4.0.b.20170401.1306, only positive numbers in the States column</p> pfSense - Bug #7075: firewall states show negative value for total bytes processedhttps://redmine.pfsense.org/issues/7075?journal_id=324292017-04-03T08:29:23ZJim Pingle
<ul><li><strong>Status</strong> changed from <i>Feedback</i> to <i>Resolved</i></li></ul>