Skip to contentSkip to conversation

extensions: libxt_CT: add translation for NOTRACK

PATCH New Pablo Neira Ayuso 1 participant 1 message Apr 15, 2020 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 extensions: libxt_CT: add translation for NOTRACK

---
 extensions/libxt_CT.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
extensions/libxt_CT.c +15 -0
index 371b21766c56..64dae325996a 100644
@@ -348,6 +348,20 @@ static void notrack_ct2_tg_init(struct xt_entry_target *target)
 	info->flags = XT_CT_NOTRACK | XT_CT_NOTRACK_ALIAS;
 }
 
+static int xlate_ct(struct xt_xlate *xl,
+		    const struct xt_xlate_tg_params *params)
+{
+	struct xt_ct_target_info_v1 *info =
+		(struct xt_ct_target_info_v1 *)params->target->data;
+
+	if (info->flags & XT_CT_NOTRACK)
+		xt_xlate_add(xl, "notrack");
+	else
+		return 0;
+
+	return 1;
+}
+
 static struct xtables_target ct_target_reg[] = {
 	{
 		.family		= NFPROTO_UNSPEC,
@@ -387,6 +401,7 @@ static struct xtables_target ct_target_reg[] = {
 		.alias		= ct_print_name_alias,
 		.x6_parse	= ct_parse_v1,
 		.x6_options	= ct_opts_v1,
+		.xlate		= xlate_ct,
 	},
 	{
 		.family        = NFPROTO_UNSPEC,
Signature · 1 line
2.11.0