netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] [RFC] nfnetlink_acct: Traffic-based and periodic notifications
@ 2013-09-04 12:05 valentina.giusti
  2013-09-04 12:05 ` [PATCH 1/4] " valentina.giusti
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: valentina.giusti @ 2013-09-04 12:05 UTC (permalink / raw)
  To: netfilter-devel
  Cc: Pablo Neira Ayuso, Patrick McHardy, Jozsef Kadlecsik,
	David S. Miller

From: Valentina Giusti <valentina.giusti@bmw-carit.de>

This patchset introduces notifications of accounting objects to userspace for
nfacct.
Notifications can be sent periodically or based on the amount of accounted bytes
or packets. In case a notification is set by giving a period as well as a given
amount of traffic, the number of notifications triggered during a period can be
rate limited.

The need for notifications stems from monitoring applications (e.g. connman)
which currently need to keep polling accounting objects via nfnl_acct_get() in 
order to get updated statistics. This is far from ideal in scenarios with large
amounts of accounting objects and diverse, unpredictable network traffic.

This implementation introduces a new message type, NFNL_MSG_ACCT_NOTIFY, which
is sent by userspace (typically, libnetfilter_acct) in order to configure
accounting notifications.
The new message parameters are NFACCT_NOTIFY_PACKETS, NFACCT_NOTIFY_BYTES and
NFACCT_NOTIFY_PERIOD, which are sent with the accounting object name. Userspace
applications would typically configure desired notification modes and then get 
appropriate notifications via netlink, on the same socket used for said
configuration.

The patches needed for libnetfilter_acct and nfacct are included in this series.

An example of nfacct usage is:

$ nfacct add http-traffic # Create the accounting object

[create related iptables rules here]

$ nfacct notify http-traffic bytes 1024
[for every 1024 bytes of HTTP traffic:]
{ pkts = 00000000000000039225, bytes = 00000000000002361568 } = http-traffic;
{ pkts = 00000000000000039245, bytes = 00000000000002362608 } = http-traffic;
...

or:

$ nfacct notify-traffic http packets 100
[for every 100 packets of HTTP traffic:]
{ pkts = 00000000000000008303, bytes = 00000000000000486469 } = http-traffic;
{ pkts = 00000000000000008403, bytes = 00000000000000494581 } = http-traffic;
...

or:

$ nfacct notify http-traffic interval 120
[every two minutes:]
{ pkts = 00000000000000008303, bytes = 00000000000000486469 } = http-traffic;
{ pkts = 00000000000000008403, bytes = 00000000000000494581 } = http-traffic;
...

or:

$ nfacct notify http-traffic bytes 1024 bytes-ratelimit 4 period 5
{ pkts = 00000000000000010172, bytes = 00000000000000628714 } = http-traffic;
{ pkts = 00000000000000010192, bytes = 00000000000000629754 } = http-traffic;
{ pkts = 00000000000000010212, bytes = 00000000000000630794 } = http-traffic;
{ pkts = 00000000000000010232, bytes = 00000000000000631834 } = http-traffic;
{ pkts = 00000000000000010894, bytes = 00000000000000672343 } = http-traffic;
...


-- 
1.7.10.4


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-09-05 15:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-04 12:05 [PATCH 0/4] [RFC] nfnetlink_acct: Traffic-based and periodic notifications valentina.giusti
2013-09-04 12:05 ` [PATCH 1/4] " valentina.giusti
2013-09-04 12:05 ` [PATCH 2/4] libnetfilter-acct: Introduce support for notifications valentina.giusti
2013-09-04 12:44   ` Pablo Neira Ayuso
2013-09-05  8:04     ` Valentina Giusti
2013-09-04 12:05 ` [PATCH 3/4] nfacct: Add 'notify' commands " valentina.giusti
2013-09-04 12:05 ` [PATCH 4/4] nfacct: Add man page section for the 'notify' commands valentina.giusti
2013-09-04 12:39 ` [PATCH 0/4] [RFC] nfnetlink_acct: Traffic-based and periodic notifications Pablo Neira Ayuso
2013-09-05  7:58   ` Valentina Giusti
2013-09-05  8:27     ` Pablo Neira Ayuso
2013-09-05 14:58       ` Valentina Giusti
2013-09-05 15:52         ` Pablo Neira Ayuso

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).