summaryrefslogtreecommitdiff
path: root/src/build.c
diff options
context:
space:
mode:
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);
}