aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/map/ip4_map.c
diff options
context:
space:
mode:
authorJon Loeliger <jdl@netgate.com>2019-11-14 16:44:40 -0600
committerOle Trøan <otroan@employees.org>2019-11-19 03:41:46 +0000
commitb15ad95124ca97dd9a800394b93f1fe19567d2e1 (patch)
treefa59c275143f0efbf531cb6240e979cefff0e436 /src/plugins/map/ip4_map.c
parent93e060aee441e98adf44a72149679a838d7084f3 (diff)
map: Fix TCP MSS clamping for MAP-E traffic.
Original MSS clamp patch by Vladimir Ratnikov. Modified to apply only to TCP packets. Type: fix Test: Wrote new unit test to ensure MAP-E TCP MSS clamping. Change-Id: I77c69714a2e3cc3b7473aa12b645243bb595c2a2 Signed-off-by: Vladimir Ratnikov <vratnikov@netgate.com> Signed-off-by: Jon Loeliger <jdl@netgate.com>
Diffstat (limited to 'src/plugins/map/ip4_map.c')
-rw-r--r--src/plugins/map/ip4_map.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/map/ip4_map.c b/src/plugins/map/ip4_map.c
index f2a00907a57..68c3d73094c 100644
--- a/src/plugins/map/ip4_map.c
+++ b/src/plugins/map/ip4_map.c
@@ -209,6 +209,20 @@ ip4_map (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
*/
port0 = ip4_map_port_and_security_check (d0, p0, &error0);
+ /*
+ * Clamp TCP MSS value.
+ */
+ if (ip40->protocol == IP_PROTOCOL_TCP)
+ {
+ tcp_header_t *tcp = ip4_next_header (ip40);
+ if (mm->tcp_mss > 0 && tcp_syn (tcp))
+ {
+ ip_csum_t csum = tcp->checksum;
+ map_mss_clamping (tcp, &csum, mm->tcp_mss);
+ tcp->checksum = ip_csum_fold (csum);
+ }
+ }
+
/* Decrement IPv4 TTL */
ip4_map_decrement_ttl (ip40, &error0);
bool df0 =