From patchwork Thu Aug 8 17:54:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pablo Neira Ayuso X-Patchwork-Id: 265795 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 B60E22C00A1 for ; Fri, 9 Aug 2013 03:55:22 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965980Ab3HHRzV (ORCPT ); Thu, 8 Aug 2013 13:55:21 -0400 Received: from mail.us.es ([193.147.175.20]:35325 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965829Ab3HHRzV (ORCPT ); Thu, 8 Aug 2013 13:55:21 -0400 Received: (qmail 6148 invoked from network); 8 Aug 2013 19:55:20 +0200 Received: from unknown (HELO us.es) (192.168.2.11) by us.es with SMTP; 8 Aug 2013 19:55:20 +0200 Received: (qmail 1604 invoked by uid 507); 8 Aug 2013 17:55:19 -0000 X-Qmail-Scanner-Diagnostics: from 127.0.0.1 by antivirus1 (envelope-from , uid 501) with qmail-scanner-2.10 (clamdscan: 0.97.8/17646. spamassassin: 3.3.2. Clear:RC:1(127.0.0.1):SA:0(-98.2/7.5):. Processed in 1.755067 secs); 08 Aug 2013 17:55:19 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on antivirus1 X-Spam-Level: X-Spam-Status: No, score=-98.2 required=7.5 tests=BAYES_50,RCVD_IN_PBL, RDNS_NONE,USER_IN_WHITELIST autolearn=disabled version=3.3.2 X-Envelope-From: pablo@netfilter.org Received: from unknown (HELO antivirus1) (127.0.0.1) by us.es with SMTP; 8 Aug 2013 17:55:17 -0000 Received: from 192.168.1.13 (192.168.1.13) by antivirus1 (F-Secure/fsigk_smtp/410/antivirus1); Thu, 08 Aug 2013 19:55:17 +0200 (CEST) X-Virus-Status: clean(F-Secure/fsigk_smtp/410/antivirus1) Received: (qmail 11269 invoked from network); 8 Aug 2013 19:55:16 +0200 Received: from unknown (HELO localhost.localdomain) (pneira@us.es@77.208.159.33) by us.es with SMTP; 8 Aug 2013 19:55:16 +0200 From: Pablo Neira Ayuso To: netfilter-devel@vger.kernel.org Subject: [PATCH nftables 2/2] netfilter: nft_log: group and qthreshold are 2^16 Date: Thu, 8 Aug 2013 19:54:31 +0200 Message-Id: <1375984471-21035-2-git-send-email-pablo@netfilter.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1375984471-21035-1-git-send-email-pablo@netfilter.org> References: <1375984471-21035-1-git-send-email-pablo@netfilter.org> Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org As defined by struct nf_loginfo. Signed-off-by: Pablo Neira Ayuso --- net/netfilter/nft_log.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/net/netfilter/nft_log.c b/net/netfilter/nft_log.c index 35a4182..65cc62f 100644 --- a/net/netfilter/nft_log.c +++ b/net/netfilter/nft_log.c @@ -39,8 +39,8 @@ static void nft_log_eval(const struct nft_expr *expr, static const struct nla_policy nft_log_policy[NFTA_LOG_MAX + 1] = { [NFTA_LOG_GROUP] = { .type = NLA_U32 }, [NFTA_LOG_PREFIX] = { .type = NLA_STRING }, - [NFTA_LOG_SNAPLEN] = { .type = NLA_U32 }, - [NFTA_LOG_QTHRESHOLD] = { .type = NLA_U32 }, + [NFTA_LOG_SNAPLEN] = { .type = NLA_U16 }, + [NFTA_LOG_QTHRESHOLD] = { .type = NLA_U16 }, }; static int nft_log_init(const struct nft_ctx *ctx, @@ -64,11 +64,14 @@ static int nft_log_init(const struct nft_ctx *ctx, li->type = NF_LOG_TYPE_ULOG; if (tb[NFTA_LOG_GROUP] != NULL) - li->u.ulog.group = ntohl(nla_get_be32(tb[NFTA_LOG_GROUP])); + li->u.ulog.group = ntohs(nla_get_be16(tb[NFTA_LOG_GROUP])); + if (tb[NFTA_LOG_SNAPLEN] != NULL) li->u.ulog.copy_len = ntohl(nla_get_be32(tb[NFTA_LOG_SNAPLEN])); - if (tb[NFTA_LOG_QTHRESHOLD] != NULL) - li->u.ulog.qthreshold = ntohl(nla_get_be32(tb[NFTA_LOG_QTHRESHOLD])); + if (tb[NFTA_LOG_QTHRESHOLD] != NULL) { + li->u.ulog.qthreshold = + ntohs(nla_get_be16(tb[NFTA_LOG_QTHRESHOLD])); + } return 0; } @@ -90,15 +93,15 @@ static int nft_log_dump(struct sk_buff *skb, const struct nft_expr *expr) if (nla_put_string(skb, NFTA_LOG_PREFIX, priv->prefix)) goto nla_put_failure; if (li->u.ulog.group) - if (nla_put_be32(skb, NFTA_LOG_GROUP, htonl(li->u.ulog.group))) + if (nla_put_be16(skb, NFTA_LOG_GROUP, htons(li->u.ulog.group))) goto nla_put_failure; if (li->u.ulog.copy_len) if (nla_put_be32(skb, NFTA_LOG_SNAPLEN, htonl(li->u.ulog.copy_len))) goto nla_put_failure; if (li->u.ulog.qthreshold) - if (nla_put_be32(skb, NFTA_LOG_QTHRESHOLD, - htonl(li->u.ulog.qthreshold))) + if (nla_put_be16(skb, NFTA_LOG_QTHRESHOLD, + htons(li->u.ulog.qthreshold))) goto nla_put_failure; return 0;