altq: dynamic queues

View: New views
4 Messages — Rating Filter:   Alert me  

altq: dynamic queues

by cnupm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

My English is no good, so I tried to describe what I want at this example:

### /etc/pf.conf
altq on bge0 bandwidth 10Mb hfsc queue { u1_in, u1_out, u2_in, u2_out...}
anchor users_queues

block all
anchor users_rules

### When user connected - teke parameter $x from DB (for example) and execute:
echo "queue u1_in bandwidth 1Kb hfsc (upperlimit $xKb)" | pfctl -a user_queues:u1_in -f -
echo "queue u1_out bandwidth 1Kb hfsc (upperlimit $xKb)" | pfctl -a user_queues:u1_out -f -
*** ... users_rules... ***

I know: it doesn't works - it's simplest way (with my English) to explain what I wont.
How to dynamicly create/delete queues?

Re: altq: dynamic queues

by Guntis Bumburs :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday 04 February 2008 01:48:40 cnupm wrote:

>
> My English is no good, so I tried to describe what I want at this example:
>
> ### /etc/pf.conf
> altq on bge0 bandwidth 10Mb hfsc queue { u1_in, u1_out, u2_in, u2_out...}
> anchor users_queues
>
> block all
> anchor users_rules
>
> ### When user connected - teke parameter $x from DB (for example) and
> execute:
> echo "queue u1_in bandwidth 1Kb hfsc (upperlimit $xKb)" | pfctl -a
> user_queues:u1_in -f -
> echo "queue u1_out bandwidth 1Kb hfsc (upperlimit $xKb)" | pfctl -a
> user_queues:u1_out -f -
> *** ... users_rules... ***
>
> I know: it doesn't works - it's simplest way (with my English) to explain
> what I wont.
> How to dynamicly create/delete queues?

Hello,

It's no possible.
You can't define queues in anchors.

ANCHORS
     Besides the main ruleset, pfctl(8) can load rulesets into anchor attach-
     ment points.  An anchor is a container that can hold rules, address
     tables, and other anchors.

--
Best Regards,
Guntis Bumburs

_______________________________________________
freebsd-pf@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-pf
To unsubscribe, send any mail to "freebsd-pf-unsubscribe@..."

Re: altq: dynamic queues

by Tom Judge :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Guntis Bumburs wrote:

> On Monday 04 February 2008 01:48:40 cnupm wrote:
>> My English is no good, so I tried to describe what I want at this example:
>>
>> ### /etc/pf.conf
>> altq on bge0 bandwidth 10Mb hfsc queue { u1_in, u1_out, u2_in, u2_out...}
>> anchor users_queues
>>
>> block all
>> anchor users_rules
>>
>> ### When user connected - teke parameter $x from DB (for example) and
>> execute:
>> echo "queue u1_in bandwidth 1Kb hfsc (upperlimit $xKb)" | pfctl -a
>> user_queues:u1_in -f -
>> echo "queue u1_out bandwidth 1Kb hfsc (upperlimit $xKb)" | pfctl -a
>> user_queues:u1_out -f -
>> *** ... users_rules... ***
>>
>> I know: it doesn't works - it's simplest way (with my English) to explain
>> what I wont.
>> How to dynamicly create/delete queues?
>
> Hello,
>
> It's no possible.
> You can't define queues in anchors.
>
> ANCHORS
>      Besides the main ruleset, pfctl(8) can load rulesets into anchor attach-
>      ment points.  An anchor is a container that can hold rules, address
>      tables, and other anchors.
>

What you could do is define X queues to start with and then use the pre
allocated queues in dynamically added rules.  If you set them up as
borrow you should be able to get the queues to scale fairly with the
number of users connected.

Tom
_______________________________________________
freebsd-pf@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-pf
To unsubscribe, send any mail to "freebsd-pf-unsubscribe@..."

Re: altq: dynamic queues

by 7charlie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

cnupm wrote:
My English is no good, so I tried to describe what I want at this example:

### /etc/pf.conf
altq on bge0 bandwidth 10Mb hfsc queue { u1_in, u1_out, u2_in, u2_out...}
anchor users_queues

block all
anchor users_rules

### When user connected - teke parameter $x from DB (for example) and execute:
echo "queue u1_in bandwidth 1Kb hfsc (upperlimit $xKb)" | pfctl -a user_queues:u1_in -f -
echo "queue u1_out bandwidth 1Kb hfsc (upperlimit $xKb)" | pfctl -a user_queues:u1_out -f -
*** ... users_rules... ***

I know: it doesn't works - it's simplest way (with my English) to explain what I wont.
How to dynamicly create/delete queues?

I worked around this by telling PF to only reload the queue section of the file.

I generate the queues from a mysql database, writing into /etc/pf.conf.  I put the "pass" rules that assign the queue into an anchor called classify_rules.

then execute:

pfctl -A -f /etc/pf.conf
pfctl -a classify_rules -f /etc/pf-classify.conf

This doesn't reload any of the main rules, and doesn't reset counters except in the anchor and for the queues.

Quoted from:
http://www.nabble.com/altq%3A-dynamic-queues-tp15260126p15260126.html