Project

General

Profile

Actions

Bug #10660

closed

PHP errors in the traffic shaper wizard

Added by Vincent Jansen almost 4 years ago. Updated over 3 years ago.

Status:
Resolved
Priority:
Low
Category:
Traffic Shaper (ALTQ)
Target version:
Start date:
06/12/2020
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
Release Notes:
Affected Version:
2.4.5-p1
Affected Architecture:

Description

Created a shaper on interface, did not apply, set bandwidth to "100%", clicked apply
Cannot open firewall_shaper.php anymore, just shows error below on fullscreen.
Revert shaper configuration via Backup & Restore solved it.

Cause seemed to be the percentage on the shaper. Perhaps it doesn't support it.
Config below.

Error:

Fatal error: Uncaught Error: Call to undefined method altq_root_queue::GetParent() in /etc/inc/shaper.inc:518 Stack trace: #0 /etc/inc/shaper.inc(1302): get_queue_bandwidth(Object(altq_root_queue)) #1 /etc/inc/shaper.inc(1516): priq_queue->CheckBandwidth(NULL, NULL) #2 /etc/inc/shaper.inc(855): priq_queue->validate_input(Array, NULL) #3 /etc/inc/shaper.inc(5052): altq_root_queue->add_queue('opt1', Array, Array, NULL) #4 /usr/local/www/firewall_shaper.php(46): read_altq_config() #5 {main} thrown in /etc/inc/shaper.inc on line 518 PHP ERROR: Type: 1, File: /etc/inc/shaper.inc, Line: 518, Message: Uncaught Error: Call to undefined method altq_root_queue::GetParent() in /etc/inc/shaper.inc:518 Stack trace: #0 /etc/inc/shaper.inc(1302): get_queue_bandwidth(Object(altq_root_queue)) #1 /etc/inc/shaper.inc(1516): priq_queue->CheckBandwidth(NULL, NULL) #2 /etc/inc/shaper.inc(855): priq_queue->validate_input(Array, NULL) #3 /etc/inc/shaper.inc(5052): altq_root_queue->add_queue('opt1', Array, Array, NULL) #4 /usr/local/www/firewall_shaper.php(46): read_altq_config() #5 {main} thrown

Shaper config:

<shaper>
    <queue>
        <interface>wan</interface>
        <name>wan</name>
        <scheduler>PRIQ</scheduler>
        <bandwidth>9</bandwidth>
        <bandwidthtype>Mb</bandwidthtype>
        <enabled>on</enabled>
        <queue>
            <name>qACK</name>
            <interface>wan</interface>
            <priority>15</priority>
            <enabled>on</enabled>
            <ecn>yes</ecn>
        </queue>
        <queue>
            <name>qDefault</name>
            <interface>wan</interface>
            <priority>0</priority>
            <enabled>on</enabled>
            <default>default</default>
            <ecn>yes</ecn>
            <codel>yes</codel>
        </queue>
    </queue>
    <queue>
        <interface>lan</interface>
        <name>lan</name>
        <scheduler>PRIQ</scheduler>
        <bandwidth>90</bandwidth>
        <bandwidthtype>Mb</bandwidthtype>
        <enabled>on</enabled>
        <queue>
            <name>qLink</name>
            <interface>lan</interface>
            <qlimit>500</qlimit>
            <priority>0</priority>
            <enabled>on</enabled>
            <default>default</default>
            <ecn>yes</ecn>
            <codel>yes</codel>
        </queue>
        <queue>
            <name>qACK</name>
            <interface>lan</interface>
            <priority>15</priority>
            <enabled>on</enabled>
            <ecn>yes</ecn>
        </queue>
    </queue>
    <queue>
        <name>opt1</name>
        <interface>opt1</interface>
        <scheduler>PRIQ</scheduler>
        <queue>
            <name>qDefault</name>
            <interface>opt1</interface>
            <qlimit></qlimit>
            <priority>0</priority>
            <description></description>
            <enabled>on</enabled>
            <default>default</default>
            <codel>yes</codel>
            <ecn>yes</ecn>
        </queue>
        <queue>
            <name>qACK</name>
            <interface>opt1</interface>
            <priority>15</priority>
            <enabled>on</enabled>
            <ecn>yes</ecn>
        </queue>
        <bandwidth>100</bandwidth>
        <bandwidthtype>%</bandwidthtype>
        <enabled>on</enabled>
    </queue>
    <queue>
        <name>opt2</name>
        <interface>opt2</interface>
        <scheduler>PRIQ</scheduler>
        <queue>
            <name>qDefault</name>
            <interface>opt2</interface>
            <qlimit></qlimit>
            <priority>0</priority>
            <description></description>
            <enabled>on</enabled>
            <default>default</default>
            <codel>yes</codel>
            <ecn>yes</ecn>
        </queue>
        <queue>
            <name>qACK</name>
            <interface>opt2</interface>
            <qlimit></qlimit>
            <priority>15</priority>
            <description></description>
            <enabled>on</enabled>
            <ecn>yes</ecn>
        </queue>
    </queue>
</shaper>

Actions #1

Updated by Vincent Jansen almost 4 years ago

% on opt1 was issue. Using mbps fixed it.

Actions #2

Updated by Vincent Jansen almost 4 years ago

2.4.5-p1

Actions #3

Updated by Viktor Gurov almost 4 years ago

  • Category set to Traffic Shaper (ALTQ)
  • Affected Version set to 2.4.5-p1
Actions #4

Updated by Viktor Gurov almost 4 years ago

Vincent Jansen wrote:

2.4.5-p1

What is your interface?
I got the same issue with vtnet interface

This may be another issue, pf.conf(5):

bandwidth

The maximum bitrate for all queues on an interface may be specified
using the bandwidth keyword. The value can be specified as an ab-
solute value or as a percentage of the interface bandwidth. When
using an absolute value, the suffixes b, Kb, Mb, and Gb are used to
represent bits, kilobits, megabits, and gigabits per second, re-
spectively. The value must not exceed the interface bandwidth. If
bandwidth is not specified, the interface bandwidth is used (but
take note that some interfaces do not know their bandwidth
, or can
adapt their bandwidth rates).
Actions #5

Updated by Vincent Jansen almost 4 years ago

Opt1 = openvpn

Actions #6

Updated by Jim Pingle almost 4 years ago

  • Priority changed from Normal to Low

That is most likely because, as Viktor noted, you tried to use % bandwidth on an interface that can't properly identify its own line rate so it cannot calculate a percentage.

The code could maybe be smarter about trying to identify that situation and warn about it when configuring in the GUI, and also before crafting % rules. Someone could pick % rules on a valid interface and then reassign interfaces to something invalid, so the backend needs to be smart about checking before loading the shaper config. If it is invalid at run-time the entire shaper config would need to be tossed out.

Actions #7

Updated by Vincent Jansen almost 4 years ago

I'd at least expected the UI to load instead of just showing an full-screen error and forcing me to revert using backing & restore.
A normal user can't be confronted with a broken UI after putting UI-allowed stuff in fields and click save.

Actions #8

Updated by Viktor Gurov almost 4 years ago

Jim Pingle wrote:

That is most likely because, as Viktor noted, you tried to use % bandwidth on an interface that can't properly identify its own line rate so it cannot calculate a percentage.

I think this should be another issue

class 'altq_root_queue' has no method 'GetParent()',
this PR adds check:
https://github.com/pfsense/pfsense/pull/4358

Actions #9

Updated by Viktor Gurov almost 4 years ago

another error after applying PR:

`There were error(s) loading the rules: pfctl: interface vtnet2 bandwidth limited to 4294967295 bps because selected 
scheduler is 32-bit limited - The line in question reads [0]: @ 2020-06-17 16:08:25`

need a way to check that interface can properly identify its own line rate

Actions #10

Updated by Renato Botelho almost 4 years ago

  • Status changed from New to Feedback
  • Assignee set to Renato Botelho
  • % Done changed from 0 to 100

PR has been merged. Thanks!

Actions #11

Updated by Max Leighton over 3 years ago

  • Status changed from Feedback to Resolved

Tested patch in 2.4.5p1 and in 2.5.0-DEVELOPMENT built on Thu Nov 05 19:03:52 EST 2020

Seems to be working as expected. I can't recreate the error anymore after applying the patch. Marking the ticket resolved.

Actions #12

Updated by Jim Pingle over 3 years ago

  • Target version set to 2.5.0
Actions #13

Updated by Jim Pingle over 3 years ago

  • Subject changed from Bug firewall_shaper.php to PHP errors in the traffic shaper wizard
Actions

Also available in: Atom PDF