summaryrefslogtreecommitdiffstats
path: root/src/build.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2012-02-07 00:53:10 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2012-02-07 00:53:10 +0100
commit721fbbde40ee5ecc966c144be11516839ab86728 (patch)
tree41c9da8d359a829e5b9f801b53f2fee1abd74d7e /src/build.c
parent8259e6dca13127e51f81ca7e75e419969417597f (diff)
conntrackd: add support to synchronize helper name
For both conntrack and expectations. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/build.c')
-rw-r--r--src/build.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/build.c b/src/build.c
index c07f429..a2901b1 100644
--- a/src/build.c
+++ b/src/build.c
@@ -65,6 +65,13 @@ ct_build_u32(const struct nf_conntrack *ct, int a, struct nethdr *n, int b)
addattr(n, b, &data, sizeof(uint32_t));
}
+static inline void
+ct_build_str(const struct nf_conntrack *ct, int a, struct nethdr *n, int b)
+{
+ const char *data = nfct_get_attr(ct, a);
+ addattr(n, b, data, strlen(data)+1);
+}
+
static inline void
ct_build_group(const struct nf_conntrack *ct, int a, struct nethdr *n,
int b, int size)
@@ -223,6 +230,9 @@ void ct2msg(const struct nf_conntrack *ct, struct nethdr *n)
/* NAT sequence adjustment */
if (nfct_attr_is_set_array(ct, nat_type, 6))
ct_build_natseqadj(ct, n);
+
+ if (nfct_attr_is_set(ct, ATTR_HELPER_NAME))
+ ct_build_str(ct, ATTR_HELPER_NAME, n, NTA_HELPER_NAME);
}
static void
@@ -270,6 +280,13 @@ exp_build_u32(const struct nf_expect *exp, int a, struct nethdr *n, int b)
addattr(n, b, &data, sizeof(uint32_t));
}
+static inline void
+exp_build_str(const struct nf_expect *exp, int a, struct nethdr *n, int b)
+{
+ const char *data = nfexp_get_attr(exp, a);
+ addattr(n, b, data, strlen(data)+1);
+}
+
void exp2msg(const struct nf_expect *exp, struct nethdr *n)
{
const struct nf_conntrack *ct = nfexp_get_attr(exp, ATTR_EXP_MASTER);
@@ -339,4 +356,5 @@ void exp2msg(const struct nf_expect *exp, struct nethdr *n)
exp_build_u32(exp, ATTR_EXP_NAT_DIR, n, NTA_EXP_NAT_DIR);
}
+ exp_build_str(exp, ATTR_EXP_HELPER_NAME, n, NTA_EXP_HELPER_NAME);
}