From patchwork Mon Mar 25 22:09:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dmitry pervushin X-Patchwork-Id: 230998 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7A19B2C009D for ; Tue, 26 Mar 2013 09:09:41 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933538Ab3CYWJg (ORCPT ); Mon, 25 Mar 2013 18:09:36 -0400 Received: from mail-we0-f170.google.com ([74.125.82.170]:33913 "EHLO mail-we0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933484Ab3CYWJf (ORCPT ); Mon, 25 Mar 2013 18:09:35 -0400 Received: by mail-we0-f170.google.com with SMTP id z2so4013417wey.15 for ; Mon, 25 Mar 2013 15:09:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=KNEw3EB/5sDfb+D68ee0bWOzbSGGE7gDTmzy3ZZO0/I=; b=Bp1JhSDgsabng3FdrQKGD2JnDQSLT5/MWEzGtpkyBK9s5TV7eV9yLIYbxRsWIUeaHg nB1x8rLeMLUQr3MUExbWFP409nxpHGn/WY59hY53WXjxL9Xd9gbJRajsCoJHvAv4yc70 xHQD1O0jIeH7lXafZ7jqxA5c3xF4kMv51Ek8S6jLDrN4XM1KQUlae+Ay240UYFYn+mQB +cmi7A1Xv8P52NaYkupZYHhLLVUyoSwWMIMebTLCQsj/BIdkzWUVN/CXJlfgclRIZkTN 8Mo0KjQcXKOg++G2KDvCQJSuyBj/U8R7AGLOQrRbHQ8KFrDAiSIS9NDTNzS0HiL9JQhj sF3A== X-Received: by 10.194.89.234 with SMTP id br10mr10596393wjb.43.1364249374067; Mon, 25 Mar 2013 15:09:34 -0700 (PDT) Received: from [1.1.1.2] (ANice-652-1-368-173.w83-201.abo.wanadoo.fr. [83.201.203.173]) by mx.google.com with ESMTPS id gl11sm30587999wic.8.2013.03.25.15.09.33 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Mar 2013 15:09:33 -0700 (PDT) Message-ID: <5150CB1E.7050409@gmail.com> Date: Mon, 25 Mar 2013 23:09:34 +0100 From: dmitry pervushin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 To: pablo@netfilter.org, netfilter-devel@vger.kernel.org Subject: Android netfilter patches (xt_IDLETIMER) [3/3] Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Changes to iptables to use updated kernel IDLETIMER structures Signed-off-by: dmitry pervushin --- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/extensions/libxt_IDLETIMER.c b/extensions/libxt_IDLETIMER.c index 21004a4..fc7a18c 100644 --- a/extensions/libxt_IDLETIMER.c +++ b/extensions/libxt_IDLETIMER.c @@ -27,14 +27,17 @@ enum { O_TIMEOUT = 0, O_LABEL, + O_SEND_NLMSG, }; -#define s struct idletimer_tg_info +#define s struct idletimer_tg_info_v1 static const struct xt_option_entry idletimer_tg_opts[] = { {.name = "timeout", .id = O_TIMEOUT, .type = XTTYPE_UINT32, .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_SEND_NLMSG, .type = XTTYPE_UINT8, + .flags = XTOPT_PUT, XTOPT_POINTER(s, send_nl_msg)}, XTOPT_TABLEEND, }; #undef s @@ -45,6 +48,7 @@ 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 Send netlink message when timer expires\n" "\n"); } @@ -52,30 +56,32 @@ static void idletimer_tg_print(const void *ip, const struct xt_entry_target *target, int numeric) { - struct idletimer_tg_info *info = - (struct idletimer_tg_info *) target->data; + struct idletimer_tg_info_v1 *info = + (struct idletimer_tg_info_v1 *) target->data; printf(" timeout:%u", info->timeout); printf(" label:%s", info->label); + printf(" send-nl-msg:%d", info->send_nl_msg ? 1 : 0); } static void idletimer_tg_save(const void *ip, const struct xt_entry_target *target) { - struct idletimer_tg_info *info = - (struct idletimer_tg_info *) target->data; + struct idletimer_tg_info_v1 *info = + (struct idletimer_tg_info_v1 *) target->data; printf(" --timeout %u", info->timeout); printf(" --label %s", info->label); + printf(" --send_nl_msg %d", info->send_nl_msg ? 1 : 0); } static struct xtables_target idletimer_tg_reg = { .family = NFPROTO_UNSPEC, .name = "IDLETIMER", .version = XTABLES_VERSION, - .revision = 0, - .size = XT_ALIGN(sizeof(struct idletimer_tg_info)), - .userspacesize = offsetof(struct idletimer_tg_info, timer), + .revision = 1, + .size = XT_ALIGN(sizeof(struct idletimer_tg_info_v1)), + .userspacesize = offsetof(struct idletimer_tg_info_v1, timer), .help = idletimer_tg_help, .x6_parse = xtables_option_parse, .print = idletimer_tg_print,