summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2011-12-31 16:39:13 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2011-12-31 16:42:31 +0100
commit187c8099704d4616de9479104ba6560c03f90c39 (patch)
treef9311aeed1c58f89bebd695f72243f506ae25020
parent3c5b8711a83caad7d6e4525a823002cac0f593a4 (diff)
conntrack: fix size of CTA_PROTOINFO_TCP_FLAGS_ORIGINAL in ARM
We have to use sizeof(struct nf_ct_tcp_flags) instead of sizeof(u_int16_t) to avoid problems in Intel IXP4xx network processor (ARM big endian). For more information, please see: http://markmail.org/message/afhn66qzyebyf7cs#query:+page:1+mid:7bw756ncuyosv23c+state:results Reported-by: Lutz Jaenicke <ljaenicke@innominate.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--include/internal/internal.h6
-rw-r--r--src/conntrack/build.c4
-rw-r--r--src/conntrack/parse.c4
3 files changed, 10 insertions, 4 deletions
diff --git a/include/internal/internal.h b/include/internal/internal.h
index 7dce03c..b2b1c43 100644
--- a/include/internal/internal.h
+++ b/include/internal/internal.h
@@ -76,4 +76,10 @@
#define NSEC_PER_SEC 1000000000L
#endif
+/* extracted from include/linux/netfilter/nf_conntrack_tcp.h .*/
+struct nf_ct_tcp_flags {
+ u_int8_t flags;
+ u_int8_t mask;
+};
+
#endif
diff --git a/src/conntrack/build.c b/src/conntrack/build.c
index 484f4d3..6e85d32 100644
--- a/src/conntrack/build.c
+++ b/src/conntrack/build.c
@@ -132,13 +132,13 @@ static void __build_protoinfo(struct nfnlhdr *req, size_t size,
nfnl_addattr_l(&req->nlh, size,
CTA_PROTOINFO_TCP_FLAGS_ORIGINAL,
&ct->protoinfo.tcp.flags[0],
- sizeof(u_int16_t));
+ sizeof(struct nf_ct_tcp_flags));
if (test_bit(ATTR_TCP_FLAGS_REPL, ct->set) &&
test_bit(ATTR_TCP_MASK_REPL, ct->set))
nfnl_addattr_l(&req->nlh, size,
CTA_PROTOINFO_TCP_FLAGS_REPLY,
&ct->protoinfo.tcp.flags[1],
- sizeof(u_int16_t));
+ sizeof(struct nf_ct_tcp_flags));
if (test_bit(ATTR_TCP_WSCALE_ORIG, ct->set))
nfnl_addattr_l(&req->nlh, size,
CTA_PROTOINFO_TCP_WSCALE_ORIGINAL,
diff --git a/src/conntrack/parse.c b/src/conntrack/parse.c
index 416573f..cb2a8dc 100644
--- a/src/conntrack/parse.c
+++ b/src/conntrack/parse.c
@@ -219,7 +219,7 @@ static void __parse_protoinfo_tcp(const struct nfattr *attr,
if (tb[CTA_PROTOINFO_TCP_FLAGS_ORIGINAL-1]) {
memcpy(&ct->protoinfo.tcp.flags[0],
NFA_DATA(tb[CTA_PROTOINFO_TCP_FLAGS_ORIGINAL-1]),
- sizeof(u_int16_t));
+ sizeof(struct nf_ct_tcp_flags));
set_bit(ATTR_TCP_FLAGS_ORIG, ct->set);
set_bit(ATTR_TCP_MASK_ORIG, ct->set);
}
@@ -227,7 +227,7 @@ static void __parse_protoinfo_tcp(const struct nfattr *attr,
if (tb[CTA_PROTOINFO_TCP_FLAGS_REPLY-1]) {
memcpy(&ct->protoinfo.tcp.flags[1],
NFA_DATA(tb[CTA_PROTOINFO_TCP_FLAGS_REPLY-1]),
- sizeof(u_int16_t));
+ sizeof(struct nf_ct_tcp_flags));
set_bit(ATTR_TCP_FLAGS_REPL, ct->set);
set_bit(ATTR_TCP_MASK_REPL, ct->set);
}