Andriy T. Yanko
2003-Jun-18 14:47 UTC
Basic principle of enqueunig/dequeuning packets & control traffic flows
Hi people! Maybe its messages is offtopic but... I have no good ideas how to solve my problem. I am writing program that must realtime control traffic flows ( control/account/bandwitdth/etc ip traffic ). I am using 2.4.x Netfilter queue kernel module (ip_queue) so program can get packets via libipq. In this case I can easy control traffic (set verdict NF_ACCEPT or NF_DROP) and statistics traffic (via counters). But how to shape traffic flow? I wrote very simple wrapper library (just based on iproute2 sources ) for tc command so pogram may set qdisc, classes and filters on some device where I what control outbox traffic. But this is not convenient way. How to build own queue(s) for specific traffic flows that going via my program and setup on them some shaping discipline like TBF - just for shape traffic, set certain rate? What is better for system perfomance when use such shaping and when using kernel QoS? Any suggestions, ideas are welcomed. THANKS IN ADVANCE. PS sorry for my poor english. -- Andriy T. Yanko wireless@wireless.org.ua * Avoid The Gates of Hell use Linux ** Wenn ich sterbe, legt mir eine Birne in mein Grab ... _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Martin A. Brown
2003-Jun-18 15:58 UTC
Re: Basic principle of enqueunig/dequeuning packets & control traffic flows
: Maybe its messages is offtopic but... I have no good ideas how to solve : my problem. It''s not at all off topic for this list. You may find, if you need more libipq help, that the netfilter-devel list is a better list, but for this general "and traffic control, too" question, you have reached the right place. : I am writing program that must realtime control traffic flows ( : control/account/bandwitdth/etc ip traffic ). I am using 2.4.x Netfilter : queue kernel module (ip_queue) so program can get packets via libipq. : In this case I can easy control traffic (set verdict NF_ACCEPT or : NF_DROP) and statistics traffic (via counters). But how to shape : traffic flow? Well, this could be tricky depending on your expectations. If you know exactly what sort of shaping you intend to use, and it doesn''t need to be dynamically manipulated, then I have an answer for you. If, on the other hand, you wish to dynamically alter the classes and bandwidth allocated to a stream, you have a bit more of a task ahead of you. [...snip...] : How to build own queue(s) for specific traffic flows that going via my : program and setup on them some shaping discipline like TBF - just for : shape traffic, set certain rate? I''m no whiz-kid with the libipq stuff, but if you can mark the packets in any way, (-j MARK --set-mark $MARK), then you can easily use a static traffic control/shaping set of qdiscs. You mention TBF--this is fine and dandy, but doesn''t allow you to classify packets. You may wish to consider learning HTB. You could set up a large number of classes each with a specific ceiling. Then you get token bucket filter for free on a subset of your traffic--each subset independently. : What is better for system perfomance when use such shaping and when : using kernel QoS? So, in summary, I would recommend creating an HTB tree, and then using dynamically altered MARKs to select packets for a particular output class. This way, you''ll not need to alter the traffic control setup once you have it configured the way you like it. : * Avoid The Gates of Hell use Linux : ** Wenn ich sterbe, legt mir eine Birne in mein Grab ... Warum ausgerechnet eine Birne? Und wessen? :) -Martin -- Martin A. Brown --- SecurePipe, Inc. --- mabrown@securepipe.com _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Andriy T. Yanko
2003-Jun-19 08:04 UTC
Re: Basic principle of enqueunig/dequeuning packets & control traffic flows
On Wed, 18 Jun 2003 10:58:52 -0500 (CDT) "Martin A. Brown" <mabrown-lartc@securepipe.com> wrote:> : I am writing program that must realtime control traffic flows ( > : control/account/bandwitdth/etc ip traffic ). I am using 2.4.x Netfilter > : queue kernel module (ip_queue) so program can get packets via libipq. > : In this case I can easy control traffic (set verdict NF_ACCEPT or > : NF_DROP) and statistics traffic (via counters). But how to shape > : traffic flow? > > Well, this could be tricky depending on your expectations. If you know > exactly what sort of shaping you intend to use, and it doesn''t need to be > dynamically manipulated, then I have an answer for you.OK. What is the answer in this case? Just set HTB qdisc with classes on certain device and setup filter based on u32 or fw?> If, on the other hand, you wish to dynamically alter the classes and > bandwidth allocated to a stream, you have a bit more of a task ahead of > you.yep.> I''m no whiz-kid with the libipq stuff, but if you can mark the packets in > any way, (-j MARK --set-mark $MARK), then you can easily use a static > traffic control/shaping set of qdiscs.OK . I wrote very simple library that is wrapper to tc command. So My program may setup qdisc, classes and filters. But how to get current rate (of traffic flow) from certain qdisc with associated with certain qdisc ? In order to get current rate value of certain class I must use rtnelink mechanism? oh... it''s nightmare for me - tried.> So, in summary, I would recommend creating an HTB tree, and then using > dynamically altered MARKs to select packets for a particular output class. > This way, you''ll not need to alter the traffic control setup once you have > it configured the way you like it.but I what change rate of class everytime... :(> Warum ausgerechnet eine Birne? Und wessen? :)Einfach. -- Andriy T. Yanko wireless@wireless.org.ua * Avoid The Gates of Hell use Linux ** Wenn ich sterbe, legt mir eine Birne in mein Grab ... _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/