From: Jan Engelhardt <jengelh@medozas.de>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH 3/6] Add stdint header and type corrections
Date: Wed, 29 Feb 2012 08:15:39 +0100 [thread overview]
Message-ID: <1330499742-28091-4-git-send-email-jengelh@medozas.de> (raw)
In-Reply-To: <1330499742-28091-1-git-send-email-jengelh@medozas.de>
1. stdint.h is needed since you use uintXX_t in various places.
2. mnl_attr_get_type yields uint16_t, prefer to use it.
3. Since ->nlattr_max is uint32_t, most dependent uses should be
unsigned too.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
.../libnetfilter_cttimeout.h | 1 +
src/libnetfilter_cttimeout.c | 11 ++++++-----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/include/libnetfilter_cttimeout/libnetfilter_cttimeout.h b/include/libnetfilter_cttimeout/libnetfilter_cttimeout.h
index be37636..89e00b6 100644
--- a/include/libnetfilter_cttimeout/libnetfilter_cttimeout.h
+++ b/include/libnetfilter_cttimeout/libnetfilter_cttimeout.h
@@ -1,6 +1,7 @@
#ifndef _LIBNETFILTER_CTTIMEOUT_H_
#define _LIBNETFILTER_CTTIMEOUT_H_
+#include <stdint.h>
#include <sys/types.h>
#include <linux/netfilter/nfnetlink_conntrack.h>
diff --git a/src/libnetfilter_cttimeout.c b/src/libnetfilter_cttimeout.c
index 6050514..707543a 100644
--- a/src/libnetfilter_cttimeout.c
+++ b/src/libnetfilter_cttimeout.c
@@ -11,6 +11,7 @@
#include <time.h>
#include <endian.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <netinet/in.h>
@@ -432,7 +433,7 @@ static int
timeout_nlmsg_parse_attr_cb(const struct nlattr *attr, void *data)
{
const struct nlattr **tb = data;
- int type = mnl_attr_get_type(attr);
+ uint16_t type = mnl_attr_get_type(attr);
if (mnl_attr_type_valid(attr, CTA_TIMEOUT_MAX) < 0)
return MNL_CB_OK;
@@ -468,7 +469,7 @@ timeout_nlmsg_parse_attr_cb(const struct nlattr *attr, void *data)
}
struct _container_policy_cb {
- int nlattr_max;
+ unsigned int nlattr_max;
void *tb;
};
@@ -477,7 +478,7 @@ parse_timeout_attr_policy_cb(const struct nlattr *attr, void *data)
{
struct _container_policy_cb *data_cb = data;
const struct nlattr **tb = data_cb->tb;
- int type = mnl_attr_get_type(attr);
+ uint16_t type = mnl_attr_get_type(attr);
if (mnl_attr_type_valid(attr, data_cb->nlattr_max) < 0)
return MNL_CB_OK;
@@ -495,13 +496,13 @@ parse_timeout_attr_policy_cb(const struct nlattr *attr, void *data)
static void
timeout_parse_attr_data(struct nfct_timeout *t, const struct nlattr *nest)
{
- int nlattr_max = timeout_protocol[t->l4num].nlattr_max;
+ unsigned int nlattr_max = timeout_protocol[t->l4num].nlattr_max;
struct nlattr *tb[nlattr_max];
struct _container_policy_cb cnt = {
.nlattr_max = nlattr_max,
.tb = tb,
};
- int i;
+ unsigned int i;
memset(tb, 0, sizeof(struct nlattr *) * nlattr_max);
--
1.7.7
next prev parent reply other threads:[~2012-02-29 7:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-29 7:15 libnetfilter_cttimeout: misc cleanup Jan Engelhardt
2012-02-29 7:15 ` [PATCH 1/6] Add .gitignore Jan Engelhardt
2012-02-29 7:15 ` [PATCH 2/6] const-ify static data objects Jan Engelhardt
2012-02-29 7:15 ` Jan Engelhardt [this message]
2012-02-29 7:15 ` [PATCH 4/6] Properly NUL-terminate name in nfct_timeout_attr_set Jan Engelhardt
2012-02-29 7:15 ` [PATCH 5/6] const-ify arguments of functions Jan Engelhardt
2012-02-29 7:15 ` [PATCH 6/6] Add extern "C" guard for C++ compilation mode Jan Engelhardt
2012-02-29 9:40 ` libnetfilter_cttimeout: misc cleanup Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1330499742-28091-4-git-send-email-jengelh@medozas.de \
--to=jengelh@medozas.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).