All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iptables: iptables-compat translation for TCPMSS
@ 2017-10-15 11:31 Aastha Gupta
  2017-10-15 11:36 ` [Outreachy kernel] " Julia Lawall
  2017-10-15 11:39 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 6+ messages in thread
From: Aastha Gupta @ 2017-10-15 11:31 UTC (permalink / raw)
  To: outreachy-kernel, pablo; +Cc: Aastha Gupta

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

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
---
 extensions/libxt_TCPMSS.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/extensions/libxt_TCPMSS.c b/extensions/libxt_TCPMSS.c
index 4b71e44..7f65298 100644
--- a/extensions/libxt_TCPMSS.c
+++ b/extensions/libxt_TCPMSS.c
@@ -91,6 +91,17 @@ 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");
+
+	return 1;
+}
+
 static struct xtables_target tcpmss_tg_reg[] = {
 	{
 		.family        = NFPROTO_IPV4,
@@ -104,6 +115,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,
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-10-15 15:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-15 11:31 [PATCH] iptables: iptables-compat translation for TCPMSS Aastha Gupta
2017-10-15 11:36 ` [Outreachy kernel] " Julia Lawall
2017-10-15 11:59   ` Aastha Gupta
2017-10-15 12:08   ` Aastha Gupta
2017-10-15 15:14     ` Julia Lawall
2017-10-15 11:39 ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.