diff options
author | Ashish Sharma <ashishsharma@google.com> | 2012-03-29 19:51:43 -0700 |
---|---|---|
committer | Ashish Sharma <ashishsharma@google.com> | 2012-04-04 18:40:18 -0700 |
commit | e07e0d31f48d951e0f03ba254d4754810732c241 (patch) | |
tree | 9c29ae2fd345f427a231611a4bd041c122105751 | |
parent | 371c311760bffad4570f4e194406f09ddc600b1c (diff) | |
download | platform_external_iptables-e07e0d31f48d951e0f03ba254d4754810732c241.tar.gz platform_external_iptables-e07e0d31f48d951e0f03ba254d4754810732c241.tar.bz2 platform_external_iptables-e07e0d31f48d951e0f03ba254d4754810732c241.zip |
Modify iptables to talk to xt_IDLETIMER version 1.android-sdk-support_r11android-cts-4.2_r1android-cts-4.1_r4android-cts-4.1_r2android-cts-4.1_r1android-4.2_r1android-4.2_pre3android-4.2_pre2.2android-4.2_pre2.1android-4.2_pre2android-4.2_pre1.1android-4.2_pre1android-4.2.1_r1.2android-4.2.1_r1.1android-4.2.1_r1android-4.1_pre2android-4.1_pre1android-4.1.2_r2.1android-4.1.2_r2android-4.1.2_r1android-4.1.1_r6.1android-4.1.1_r6android-4.1.1_r5android-4.1.1_r4android-4.1.1_r3android-4.1.1_r2android-4.1.1_r1.1android-4.1.1_r1android-4.1-sdk_pre1tools_r21jb-releasejb-mr1-releasejb-mr1-factory-releasejb-mr1-devjb-mr0-releasejb-devics-plus-aosp
Change-Id: Ib144c5289681cdff21b21be74173164d097710e7
-rw-r--r-- | extensions/libxt_IDLETIMER.c | 9 | ||||
-rw-r--r-- | extensions/libxt_IDLETIMER.man | 4 | ||||
-rw-r--r-- | include/linux/netfilter/xt_IDLETIMER.h | 8 |
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))); }; |