diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2009-07-16 11:04:56 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2009-07-16 11:04:56 +0200 |
commit | 867cda50716d393e132001484c6f0a4ae50e7eb9 (patch) | |
tree | d934d1083f9843041b0028fc1ed26580a9f90edb /src/conntrack | |
parent | 9cc1f1c7cf7eae4a795849ef637203e1d3cd38c1 (diff) |
dccp: fix endianess in handshake_seq
This patch fixes missing endianess conversion of the new
attribute ATTR_HANDSHAKE_SEQ that was included in
19f35b21dbe2bb4386eeced4e0d87f3b2e1d.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/conntrack')
-rw-r--r-- | src/conntrack/build.c | 11 | ||||
-rw-r--r-- | src/conntrack/parse.c | 5 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/conntrack/build.c b/src/conntrack/build.c index dea0c75..623774f 100644 --- a/src/conntrack/build.c +++ b/src/conntrack/build.c @@ -160,11 +160,18 @@ static void __build_protoinfo(struct nfnlhdr *req, size_t size, CTA_PROTOINFO_DCCP_ROLE, &ct->protoinfo.dccp.role, sizeof(u_int8_t)); - if (test_bit(ATTR_DCCP_HANDSHAKE_SEQ, ct->set)) + if (test_bit(ATTR_DCCP_HANDSHAKE_SEQ, ct->set)) { + /* FIXME: use __cpu_to_be64() instead which is the + * correct operation. This is a semantic abuse but + * we have no function to do it in libnfnetlink. */ + u_int64_t handshake_seq = + __be64_to_cpu(ct->protoinfo.dccp.handshake_seq); + nfnl_addattr_l(&req->nlh, size, CTA_PROTOINFO_DCCP_SEQ, - &ct->protoinfo.dccp.handshake_seq, + &handshake_seq, sizeof(u_int64_t)); + } nfnl_nest_end(&req->nlh, nest_proto); nfnl_nest_end(&req->nlh, nest); default: diff --git a/src/conntrack/parse.c b/src/conntrack/parse.c index ce4b673..bf72545 100644 --- a/src/conntrack/parse.c +++ b/src/conntrack/parse.c @@ -262,8 +262,9 @@ static void __parse_protoinfo_dccp(const struct nfattr *attr, set_bit(ATTR_DCCP_ROLE, ct->set); } if (tb[CTA_PROTOINFO_DCCP_SEQ-1]) { - ct->protoinfo.dccp.handshake_seq = - *(u_int64_t *)NFA_DATA(tb[CTA_PROTOINFO_DCCP_SEQ-1]); + ct->protoinfo.dccp.handshake_seq = + __be64_to_cpu(*(u_int64_t *) + NFA_DATA(tb[CTA_PROTOINFO_DCCP_SEQ-1])); set_bit(ATTR_DCCP_HANDSHAKE_SEQ, ct->set); } } |