Ok, maybe I was far from current state of PF rules... Let's do step by step.
For start discussion I will use this more or less real example:

altq on $ext_if cbq bandwidth 100Mb queue { std, pq }
 queue std bandwidth 98Mb cbq(default, borrow)
 queue pq bandwidth 1024Kb cbq { pq_1, pq_2, pq_3, pq_4 }
  queue pq_1 bandwidth 256Kb
  queue pq_2 bandwidth 256Kb
  queue pq_3 bandwidth 256Kb
  queue pq_4 bandwidth 256Kb

pass out on $ext_if inet from any to 192.168.0.1 keep state queue pq_1
pass out on $ext_if inet from any to 192.168.0.2 keep state queue pq_2
pass out on $ext_if inet from any to 192.168.0.3 keep state queue pq_3
pass out on $ext_if inet from any to 192.168.0.4 keep state queue pq_4

Now I want to start from another side. I want make pfctl to create
child queues automatically, using config like this:
altq on $ext_if cbq bandwidth 100Mb queue { std, pq }
 queue std bandwidth 98Mb cbq(default, borrow)
 queue pq bandwidth 1024Kb cbq spray_child 4

As you see, I want to add keywords "spray_child 4" which must be
interpreted as "create 4 child queues each with 1/4 bandwidth of
parent queue". In the end, pfctl must create same queues as in upper
example.
I imagine to add SLIST_QUEUE into struct pf_altq for keeping "qid"s
and "index number"s of child queues (automatically created). Then I
plan to add creation of child queues into function 'eval_pfqueue' (in
pfctl_altq.c). And "qid"s and "index number"s of these created queues
will be stored in SLIST_QUEUE of parent rule ("pq").
So, in pf_test() instead of searching child queue by name I can just
walk through r->...(SLIST_QUEUE)... and get one with needed "index
number" (with index_number == i_diff, see my "patch" in first mail)
and use it's qid.

I think it will be fast enought for pf, at least it looks so.

May I ask someone to help me with parse.y?
-- 
antonvm

Reply via email to