Patch for assigning multiple queues to the same interface

  • I have a Multi-WAN setup and need to shape the traffic on the LAN interface through 3 different queues. pfSense is almost set to do it, but the get_queue_bandwidth() function is not prepared to get a list of queues as an argument. Once the following patch is applied (which is not perfect, but will be fine for most setups), once can do this. One can of course still only define one default queue, but the others can be defined through rules. This patch should fix "no parent queue" type errors in Multi-WAN setups. It basically just returns the sum of bandwidths when it receives several queues as an argument. Watch out though, it assumes that you have used the same bandwidth types for the queues in question. Otherwise things will probably not work.

    ---     2008-01-27 16:31:51.000000000 +0100
    +++  2008-01-27 16:33:47.000000000 +0100
    @@ -251,6 +251,17 @@
     function get_queue_bandwidth($name) {
            global $config;
    +        if (strpos($name, ' ') !== false) {
    +                $names = split(' ', $name);
    +                foreach ($names as $queue) {
    +                        $bw = get_queue_bandwidth($queue);                        
    +                        $bw_sum += $bw['bandwidth']; 
    +                }
    +                return  array(
    +                                'bandwidth' => $bw_sum,
    +                                'bandwidthtype' => $bw['bandwidthtype']
    +                );
    +        } 
            foreach ($config['shaper']['queue'] as $queue) {
                    if ($queue['name'] == $name) {
                            return array(

  • Actually after reading of the major overhaul of the Traffic Shaping for 1.3, this probably is only relevant to 1.2.

  • I still don't understand what this is useful for but anyway!

  • If by "anyway" you mean it doesn't matter, then I suppose it doesn't. I don't want to steal anyone's show. I just came across errors when assigning several root queues to the same interface and that was because the get_queues_bandwidth function returned an empty string when it received several queues as an argument. That resulted in a faulty "altq on" rule. This patch seemed to me the simplest way of fixing it for the moment and I thought perhaps other people can benefit from it as well. This was the only reason for this post. Feel free to delete it.

  • No, sorry, the anyway means its me not understanding it!

    Oh i see, yeah for some setups it is useful.

Log in to reply