summaryrefslogtreecommitdiff
path: root/src/build.c
diff options
context:
space:
mode:
author/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-02-09 20:07:36 +0000
committer/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-02-09 20:07:36 +0000
commit7784ef33db4361269afe9b302fa9dbb4a65aaf35 (patch)
treeab49008b2ece72bf0b9bb122b3d40bfc17119855 /src/build.c
parent2da4ea01c1913622669e6f638f06483c257797f7 (diff)
downloadconntrack-tools-7784ef33db4361269afe9b302fa9dbb4a65aaf35.tar.gz
conntrack-tools-7784ef33db4361269afe9b302fa9dbb4a65aaf35.zip
o add IPv6 information to synchronization messages
o add support for NAT sequence adjustment (requires Linux kernel >= 2.6.25) o remove TODO file from release tarballs
Diffstat (limited to 'src/build.c')
-rw-r--r--src/build.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/build.c b/src/build.c
index 3de1c25..d6c8837 100644
--- a/src/build.c
+++ b/src/build.c
@@ -58,6 +58,14 @@ static void __build_u32(const struct nf_conntrack *ct,
addattr(pld, attr, &data, sizeof(uint32_t));
}
+static void __build_pointer_be(const struct nf_conntrack *ct,
+ struct netpld *pld,
+ int attr,
+ size_t size)
+{
+ addattr(pld, attr, nfct_get_attr(ct, attr), size);
+}
+
static void __nat_build_u32(uint32_t data, struct netpld *pld, int attr)
{
data = htonl(data);
@@ -70,13 +78,17 @@ static void __nat_build_u16(uint16_t data, struct netpld *pld, int attr)
addattr(pld, attr, &data, sizeof(uint16_t));
}
-/* XXX: IPv6 and ICMP not supported */
+/* XXX: ICMP not supported */
void build_netpld(struct nf_conntrack *ct, struct netpld *pld, int query)
{
if (nfct_attr_is_set(ct, ATTR_IPV4_SRC))
- __build_u32(ct, pld, ATTR_IPV4_SRC);
+ __build_pointer_be(ct, pld, ATTR_IPV4_SRC, sizeof(uint32_t));
if (nfct_attr_is_set(ct, ATTR_IPV4_DST))
- __build_u32(ct, pld, ATTR_IPV4_DST);
+ __build_pointer_be(ct, pld, ATTR_IPV4_DST, sizeof(uint32_t));
+ if (nfct_attr_is_set(ct, ATTR_IPV6_SRC))
+ __build_pointer_be(ct, pld, ATTR_IPV6_SRC, sizeof(uint32_t)*4);
+ if (nfct_attr_is_set(ct, ATTR_IPV6_DST))
+ __build_pointer_be(ct, pld, ATTR_IPV6_DST, sizeof(uint32_t)*4);
if (nfct_attr_is_set(ct, ATTR_L3PROTO))
__build_u8(ct, pld, ATTR_L3PROTO);
if (nfct_attr_is_set(ct, ATTR_PORT_SRC))