netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Zintakis <michael.zintakis@googlemail.com>
To: netfilter-devel@vger.kernel.org
Subject: iptables nfacct match question
Date: Sat, 23 Feb 2013 20:57:37 +0000	[thread overview]
Message-ID: <51292D41.8000703@googlemail.com> (raw)

As part of my daily job, I am currently trying to expand the functionality of the 4 netfilter components dealing with accounting: nfacct (executable), nfnetlink_acct (userspace library), nfacct (kernel part) and iptables match (kernel+userspace).

I need to be able to pre-select the number formatting of "bytes" and "packets" for each registered nfacct name using additional option in the nfacct iptables match (called --nfacct-fmt). Each registered nfacct name would have different formatting depending on the amount of traffic and also other factors. This formatting is going to be used mainly by invoking nfacct (executable) as plain text (in other words as "nfacct list").

What I currently implemented is add an additional property to nfacct struct (uint16_t fmt), storing the format to be used for "bytes" and "packets" for each registered name. The higher 8 bits of that number contain the format to be used for "packets", the lower 8 bits - for "bytes".

I was able to successfully modify the kernel part (nfacct), nfacct (the executable) and libnfnetlink_act userspace library to accommodate the above change, but I am currently struggling with modifying the nfacct match in iptables.

The problem arises when new nfacct match is used against old version of the nfacct iptables match in the kernel. It all stems from "struct xt_nfacct_match_info", which I need to expand in order to include the new option, but since this struct is part of kernel-headers, I am unable to do that, so I thought to ask for a bit of advice on this list!

One possible solution for me is to add a new pair of parse and print functions, as well as add another element to the nfacct_match array defined in libxt_nfacct.c to accommodate this new functionality and then use these newly-defined functions to possibly communicate with the kernel part to propagate/retrieve the new uint16_t fmt property value via nfnetlink. 

This approach seems to me a bit overly complex so I thought to ask - is this the "usual" way of dealing with such scenarios or is there another, simpler (or better) alternative? Thank you!


MZ

             reply	other threads:[~2013-02-23 20:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-23 20:57 Michael Zintakis [this message]
2013-02-25 15:48 ` iptables nfacct match question Pablo Neira Ayuso
2013-02-25 20:20   ` Michael Zintakis
2013-02-26 13:55     ` Pablo Neira Ayuso
2013-02-26 19:23       ` Michael Zintakis
2013-02-26 21:47         ` Pablo Neira Ayuso
2013-02-27 20:57           ` Michael Zintakis
2013-03-23 12:12             ` Michael Zintakis
2013-04-04 20:37             ` Michael Zintakis
2013-04-04 21:46               ` Jozsef Kadlecsik
2013-04-05 19:10                 ` Michael Zintakis
2013-04-05 19:24                   ` Jozsef Kadlecsik
2013-04-05 19:34                     ` Michael Zintakis
2013-04-05 21:01                       ` Jozsef Kadlecsik
2013-04-06 16:14                         ` Michael Zintakis
2013-04-05 19:27                   ` Michael Zintakis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51292D41.8000703@googlemail.com \
    --to=michael.zintakis@googlemail.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).