aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshish Sharma <ashishsharma@google.com>2012-03-29 19:51:43 -0700
committerAshish Sharma <ashishsharma@google.com>2012-04-04 18:40:18 -0700
commite07e0d31f48d951e0f03ba254d4754810732c241 (patch)
tree9c29ae2fd345f427a231611a4bd041c122105751
parent371c311760bffad4570f4e194406f09ddc600b1c (diff)
downloadplatform_external_iptables-jb-mr0-release.tar.gz
platform_external_iptables-jb-mr0-release.tar.bz2
platform_external_iptables-jb-mr0-release.zip
Change-Id: Ib144c5289681cdff21b21be74173164d097710e7
-rw-r--r--extensions/libxt_IDLETIMER.c9
-rw-r--r--extensions/libxt_IDLETIMER.man4
-rw-r--r--include/linux/netfilter/xt_IDLETIMER.h8
3 files changed, 20 insertions, 1 deletions
diff --git a/extensions/libxt_IDLETIMER.c b/extensions/libxt_IDLETIMER.c
index 21004a4b..5f1b9fe7 100644
--- a/extensions/libxt_IDLETIMER.c
+++ b/extensions/libxt_IDLETIMER.c
@@ -27,6 +27,7 @@
enum {
O_TIMEOUT = 0,
O_LABEL,
+ O_NETLINK,
};
#define s struct idletimer_tg_info
@@ -35,6 +36,8 @@ static const struct xt_option_entry idletimer_tg_opts[] = {
.flags = XTOPT_MAND | XTOPT_PUT, XTOPT_POINTER(s, timeout)},
{.name = "label", .id = O_LABEL, .type = XTTYPE_STRING,
.flags = XTOPT_MAND | XTOPT_PUT, XTOPT_POINTER(s, label)},
+ {.name = "send_nl_msg", .id = O_NETLINK, .type = XTTYPE_UINT8,
+ .flags = XTOPT_PUT, XTOPT_POINTER(s, send_nl_msg)},
XTOPT_TABLEEND,
};
#undef s
@@ -45,6 +48,8 @@ static void idletimer_tg_help(void)
"IDLETIMER target options:\n"
" --timeout time Timeout until the notification is sent (in seconds)\n"
" --label string Unique rule identifier\n"
+" --send_nl_msg (0/1) Enable netlink messages,"
+ " and show remaining time in sysfs. Defaults to 0.\n"
"\n");
}
@@ -57,6 +62,7 @@ static void idletimer_tg_print(const void *ip,
printf(" timeout:%u", info->timeout);
printf(" label:%s", info->label);
+ printf(" send_nl_msg:%u", info->send_nl_msg);
}
static void idletimer_tg_save(const void *ip,
@@ -67,13 +73,14 @@ static void idletimer_tg_save(const void *ip,
printf(" --timeout %u", info->timeout);
printf(" --label %s", info->label);
+ printf(" --send_nl_msg %u", info->send_nl_msg);
}
static struct xtables_target idletimer_tg_reg = {
.family = NFPROTO_UNSPEC,
.name = "IDLETIMER",
.version = XTABLES_VERSION,
- .revision = 0,
+ .revision = 1,
.size = XT_ALIGN(sizeof(struct idletimer_tg_info)),
.userspacesize = offsetof(struct idletimer_tg_info, timer),
.help = idletimer_tg_help,
diff --git a/extensions/libxt_IDLETIMER.man b/extensions/libxt_IDLETIMER.man
index e3c91cea..3b5188d9 100644
--- a/extensions/libxt_IDLETIMER.man
+++ b/extensions/libxt_IDLETIMER.man
@@ -18,3 +18,7 @@ This is the time in seconds that will trigger the notification.
\fB\-\-label\fP \fIstring\fP
This is a unique identifier for the timer. The maximum length for the
label string is 27 characters.
+.TP
+\fB\-\---send_nl_msg\fP \fI(0/1)\fP
+Send netlink messages in addition to sysfs notifications and show remaining
+time. Defaults to 0.
diff --git a/include/linux/netfilter/xt_IDLETIMER.h b/include/linux/netfilter/xt_IDLETIMER.h
index 208ae938..faaa28b3 100644
--- a/include/linux/netfilter/xt_IDLETIMER.h
+++ b/include/linux/netfilter/xt_IDLETIMER.h
@@ -4,6 +4,7 @@
* Header file for Xtables timer target module.
*
* Copyright (C) 2004, 2010 Nokia Corporation
+ *
* Written by Timo Teras <ext-timo.teras@nokia.com>
*
* Converted to x_tables and forward-ported to 2.6.34
@@ -32,12 +33,19 @@
#include <linux/types.h>
#define MAX_IDLETIMER_LABEL_SIZE 28
+#define NLMSG_MAX_SIZE 64
+
+#define NL_EVENT_TYPE_INACTIVE 0
+#define NL_EVENT_TYPE_ACTIVE 1
struct idletimer_tg_info {
__u32 timeout;
char label[MAX_IDLETIMER_LABEL_SIZE];
+ /* Use netlink messages for notification in addition to sysfs */
+ __u8 send_nl_msg;
+
/* for kernel module internal use only */
struct idletimer_tg *timer __attribute__((aligned(8)));
};