Skip to contentSkip to conversation

iptables: iptables-compat translation for TCPMSS

PATCH Applied Aastha Gupta 2 participants 2 messages Oct 15, 2017 – Oct 17, 2017 netfilter

v2 of 3 Applied Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 iptables: iptables-compat translation for TCPMSS

Since path mtu support was added, we can now add
iptables-compat translation for TCPMSS extension.

---
changes in v2:
- translate other options in TCPMSS target extension
- fixed code styling issues

 extensions/libxt_TCPMSS.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
extensions/libxt_TCPMSS.c +14 -0
index 4b71e44..0d9b200 100644
@@ -91,6 +91,19 @@ static void TCPMSS_save(const void *ip, const struct xt_entry_target *target)
 		printf(" --set-mss %u", mssinfo->mss);
 }
 
+static int TCPMSS_xlate(struct xt_xlate *xl,
+			const struct xt_xlate_tg_params *params)
+{
+	const struct xt_tcpmss_info *mssinfo =
+		(const struct xt_tcpmss_info *)params->target->data;
+	if (mssinfo->mss == XT_TCPMSS_CLAMP_PMTU)
+		xt_xlate_add(xl, "tcp option maxseg size set rt mtu");
+	else
+		xt_xlate_add(xl, "tcp option maxseg size set %d", mssinfo->mss);
+
+	return 1;
+}
+
 static struct xtables_target tcpmss_tg_reg[] = {
 	{
 		.family        = NFPROTO_IPV4,
@@ -104,6 +117,7 @@ static struct xtables_target tcpmss_tg_reg[] = {
 		.x6_parse      = TCPMSS_parse,
 		.x6_fcheck     = TCPMSS_check,
 		.x6_options    = TCPMSS4_opts,
+		.xlate         = TCPMSS_xlate,
 	},
 	{
 		.family        = NFPROTO_IPV6,
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw
Quoted 2 lines · Aastha Gupta

Since path mtu support was added, we can now add
iptables-compat translation for TCPMSS extension.

Applied, thanks.