OSDN Git Service

netfilter: xtables: Add snapshot of hardidletimer target
authorManoj Basapathi <manojbm@codeaurora.org>
Thu, 6 Feb 2020 11:07:29 +0000 (16:37 +0530)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sun, 15 Mar 2020 14:20:16 +0000 (15:20 +0100)
commit68983a354a655c35d3fb204489d383a2a051fda7
treeccb7bb73eafc259a43d5f242712dee4a6b8b9e6a
parentc3c831b0a241c6003c82bc1f2d55460d3f4c0ee5
netfilter: xtables: Add snapshot of hardidletimer target

This is a snapshot of hardidletimer netfilter target.

This patch implements a hardidletimer Xtables target that can be
used to identify when interfaces have been idle for a certain period
of time.

Timers are identified by labels and are created when a rule is set
with a new label. The rules also take a timeout value (in seconds) as
an option. If more than one rule uses the same timer label, the timer
will be restarted whenever any of the rules get a hit.

One entry for each timer is created in sysfs. This attribute contains
the timer remaining for the timer to expire. The attributes are
located under the xt_idletimer class:

/sys/class/xt_idletimer/timers/<label>

When the timer expires, the target module sends a sysfs notification
to the userspace, which can then decide what to do (eg. disconnect to
save power)

Compared to IDLETIMER, HARDIDLETIMER can send notifications when
CPU is in suspend too, to notify the timer expiry.

v1->v2: Moved all functionality into IDLETIMER module to avoid
code duplication per comment from Florian.

Signed-off-by: Manoj Basapathi <manojbm@codeaurora.org>
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/uapi/linux/netfilter/xt_IDLETIMER.h
net/netfilter/xt_IDLETIMER.c