On Tue, Oct 4, 2011 at 1:02 PM, Jan Engelhardt <jengelh@xxxxxxxxxx> wrote: > On Tuesday 2011-10-04 06:50, Julien Lafaye wrote: >> >>I created a small packet statistics accounting module based on the >>xtables framework. It is based on a FIFO that is filled in netfilter >>hooks and emptied by a user program reading statistics through /proc >>callbacks. The goal of the module is to be able to get maximum traffic >>rate with an improved resolution compared to basic techniques. Typical >>expected resolution is 100ms. > > I am thinking of how xt_quota2 (in grow mode) could have been enhanced > to simply reset the counter when the procfs file is read. How would that > have compared to your module? My objective was to count incoming packets & bytes received during short time frames, i.e. 100ms even 10ms. I first thought of having a user program polling statistics but I would have to rely on accurate scheduling of the polling process by the OS. I wanted to be able to deploy the accounting module on Centos 5 kernels (2.6.18) which does not have the dynticks features and no guarantee that the polling process will be awakened when I wanted it to be. So, I chose to build time buckets directly in the softirq handler and export them with /proc. I agree that polling the xt_quota2 counter and resetting at each poll will achieve the same functionality but I would run tests to check that polling is actually scheduled at regular enough intervals. >>The code is currently stored in github: >>https://github.com/jlafaye/xt_pktstat >> >>I would like the code to be considered for inclusion in the >>xtables-addons framework. Nevertheless, the code might not be mature >>enough as this is the first time I do kernel programming. Although >>advised by knowledgeable persons, there are probably many issues in it. > > The .c files need a little license-mentioning header at the least, and > should in principle also use tab indents like LKCS.-See files from Xt-a > for examples. OK -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html